Game Development Reference
In-Depth Information
Figure 10.1
High-level game flow.
can be given a health value and take multiple shots to be destroyed. When de-
stroyed they should explode.
By reading this quick description of the game, it's easy to start building up a list
of classes and interactions. A good way to start the technical plan is to draw some
boxes for the main classes and some arrows for the major interactions. We'll
need three main game states, and the inner game state will be the most compli-
cated. By looking at the game description, you can see that some of the
important classes needed include Player , Level , Enemy , and Bullet . The
level needs to contain and update the players, enemies, and bullets. Bullets
should collide with enemies and players.
The inner game is where the player will fly the spaceship and blow up the
oncoming enemies. The player ship will not actually move through space;
instead, the movement will be faked. The player can move the player anywhere
on the screen but the ''camera'' will stay fixed dead center. To give the
impression of speeding through space, the background will be scrolled in
the opposite direction the player is traveling. This greatly simplifies any player
tracking or camera code.
This is a small game so we can start coding with this rather informal description.
All game code goes in the game project and any code we generate that might be
useful for multiple projects can go in the engine library. A more ambitious game
plan might require a few small test programs—game states are very good for
sketching out such code ideas.
The First Implementation Pass
The high-level view has broken the game down into three states. This first coding
pass will create these three states and make them functional.
 
 
Search WWH ::




Custom Search