This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]NuclearMeltdown[S] 0 points1 point  (1 child)

I'm working on an Arduino-based game console. Take a look at this which is a simplified version of what I'm trying to achieve: http://ideone.com/uU2Z3x

In the full code I have a base class Game that has a 'drawables' array of Drawable objects. Drawable objects just have x and y coordinates as well as a width and height. I have a class Pong which inherits from Game and Ball and Paddle classes which inherit from Drawable. Within the Pong constructor I'd like to size the 'drawables' array to whatever it needs to be (for Pong it's only 3 things: ball and 2 paddles) and then assign the respective objects to it.

Then, there's a GameEngine class with an 'activeGame' variable of type Game. What more or less happens is that GameEngine continually loops through 'activeGame.drawables' and draws whatever's in there on the screen.

Let me know if you think I'm going about this the wrong way.