Geo Blaster Game Structure
The structure of the game application is very similar to the structure we started to build earlier in this chapter. Let’s take a closer look at the state functions and how they will work together.
Game application states
Our game will have seven distinct game application states. We will store these in constants:
Game application state functions
Each individual state will have an associated function that will be called on each frame tick. Let’s look at the functionality for each:
Displays the title screen text and waits for the space bar to be pressed before the game starts.
Sets up all the defaults for a new game. All of the arrays for holding display objects are reinitialized—the game
levelis reset to
0, and the game
scoreis set to
levelvalue by one and then sets the “game knob” values to control the level difficulty. See the upcoming section Level Knobs for details.
Fades the player graphic onto the screen from
1. When this is complete, level play will start.
Controls the play of the game level. It calls the
render()functions, as well as the functions for evaluating keyboard input for player ship control. ...