Time for action - updating the Game1 class

  1. Add the following declarations to the Game1 class:
    enum GameStates {TitleScreen, Playing, WaveComplete, GameOver};
    GameStates gameState = GameStates.TitleScreen;
    float gameOverTimer = 0.0f;
    float gameOverDelay = 6.0f;
    float waveCompleteTimer = 0.0f;
    float waveCompleteDelay = 6.0f;
  2. Remove the call to GoalManager.GenerateComputers() from the LoadContent() method of the Game1 class.
  3. Add the checkPlayerDeath() method to the Game1 class:
    private void checkPlayerDeath()
    foreach (Enemy enemy in EnemyManager.Enemies)
    if (enemy.EnemyBase.IsCircleColliding(
    gameState = GameStates.GameOver;
  4. Replace the existing Update() method of the ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.