The game structure

Now that we have nearly all of the pieces of our game in place, we need to start bringing them together into a structure that supports a normal game flow, from title screen, to playing, to game over, and back to the title screen:

The game structure

The game will begin in the TitleScreen state. When the user begins the game, the state switches to Playing, until the user collides with an enemy ship, an enemy shot, or an asteroid. At that point, the state switches to PlayerDead.

The game remains in the PlayerDead state for a few seconds to let the player agonize over their defeat, and to allow any enemy ships on the screen to move off screen. At that ...

Get XNA 4.0 Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.