Subscribe to gabehabe's on-topic ramblings        RSS Feed

Planning a project: Pong

Icon Leave Comment
Any code requires a well thought-out plan. Let's get a few ideas going and build from that.

What do we want to make?
Nothing flashy, just a simple recreation of pong, to get the basic understanding of how a game should be put together.

What do we need to plan?
1) Classes - will we be going for an OOP approach? (yes, I'm an OO guy) :)
2) Functions - update the screen, move the ball, anything that will be repeated within the game
3) Event handling - making stuff happen, depending on what the user does... Nothing fancy here, just a few key presses
4) Different game modes - 1P v CPU, and how about a twist version, too?

So what's gonna make this version different to the 2,988,817,751,773 other pong remakes out there?
Probably nothing. It will have a few half-decent graphics, and this "twist" version that I mentioned earlier.
Basically, in this "twist" version, both paddles will be controlled by the player. However, one paddle will move up, while the other moves down.

Planning our classes
Nothing too complicated here, just a few simple variables:
class paddle
	// a surface to load the image on
	// a rectangle (where the surface will be loaded)
	// a constructor to give the surface and rectangle some meaning

class ball
	// a surface to load the image on
	// a rectangle to draw the surface to
	// x and y velocity (for movement)
	// a constructor to apply all the above

Planning our functions
I can think of 5 things that are going to be done regularly:
1) Load an image to a surface
2) Apply a surface to the screen
3) Update all the surfaces being used
4) Move the ball
5) Quit the game

These will come in later, the titles of the functions should roughly give away how they should be defined anyway.

Planning the different game modes
I only plan to make 2 game modes at the moment, 1P v CPU and 1P special (our "twist" version)
I might add a 2 player later, but for now let's just stick with one player and keep things as simple as possible! :)

Planning the main game - a menu to start it all off?
Everything will need to be initialised here.
Also, I want to add a menu for different options. I foresee four different options for now:
1) 1P special
2) 1P v CPU
3) Help
4) About

And with that all planned out, let's get started with our actual program!

0 Comments On This Entry


December 2017

101112131415 16

Request A Topic!

Want me to blog about something? Perhaps a language? A piece of software? A specific topic? Let me know! Even guests can post here on my blog!

If you would like to request a topic, please post a comment here and I'll get on it right away! smile.gif

Search My Blog

0 user(s) viewing

0 Guests
0 member(s)
0 anonymous member(s)

gabehabe's off-topic ramblings

Follow me on Twitter!
lol, my other blog died a horrible lonely death. Ah well.

Smiley of the [however often I change it]

IPB Image

Contact Me

e-mail: [email protected]

Google Talk: [email protected]
MSN: [email protected]
Yahoo: gabehabe (rarely used)
AIM: gabehabe (rarely used)

Skype: gabehabe

Want me to work for you? [click]