Game Development Reference
In-Depth Information
_renderer.Render();
}
#endregion
}
}
This class needs to be loaded like the rest in the form.cs class.
private void InitializeGameState()
{
// Game states are loaded here
_system.AddState("start_menu", new StartMenuState(_titleFont,
_generalFont, _input, _system));
_system.AddState("inner_game", new InnerGameState(_system, _input,
_persistantGameData, _generalFont));
_system.AddState("game_over", new GameOverState(_persistantGameData,
_system, _input, _generalFont, _titleFont));
_system.ChangeState("start_menu");
}
The GameOverState creates a title and message for winning and losing the
game. It then uses the persistent data JustWon member to decide which mes-
sage to display. It also has a counter, and the state eventually times out returning
the user to the start menu.
The creation of these three states completes the first pass of the game. The game,
while currently not very fun, is already in a complete state. The next section will
add more detail to the inner game and refine the overall structure to make it look
better.
Developing the Inner Game
The inner game currently doesn't allow any interaction and times out after a few
seconds. To make the inner game state more game-like, a PlayerCharacter
needs to be introduced and the player needs to be able to move the character
around. This will be the first goal. It's important to create a game in a series of
small achievable goals that are well defined; it makes it much easier to write the
code. In this case, the PlayerCharacter will be some type of spaceship.
Once the first goal is reached then the player needs to feel as though he is
advancing through a level. This will be done by scrolling the background texture.
The next small goal is to let the player shoot bullets. Bullets need something to
 
 
Search WWH ::




Custom Search