![]() |
OO Game Programming tutorial - Part 2 |
Game Design
The main game loop The main game loop of most games basically goes like this: Handle input Pong is no different. With these in mind we shall structure our Game_Main function around this.
Game States The game will be in various states while running. We need to take care of these so we will have a global named gameState and define these at the beginning of our code. These are:
The GETREADY state will be a state when the player's have a chance to get ready when the ball is reset after a goal or a new game is started.
Game Objects We will make use of the OO technology we should look at what objects the game will use. The advantages of using OO to encapsulate the objects will makes things a great deal more organised. Practicing these methods now will pay off when you have a large project, you wont have to wade through so much code to make modifications. For a game such as Pong there aren't too many:- Paddle Each of these we will create a class for and fill in as we progress. |