protected override void Initialize() { start = new Vector2(120, graphics.GraphicsDevice.Viewport.Height - 180); thePlayer = new Player(this, start); // Add player to game if (!Components.Contains(thePlayer)) Components.Add(thePlayer); // Set values for keys (subject to change) missileButton = Keys.X; bombButton = Keys.Z; pauseButton = Keys.Space; paused = false; k_old = Keyboard.GetState(); // Countdown before first enemy generates r = new Random(); enemyCountdown = (float)(r.Next(100) + 50); maxEnemies = 1; missileCountdown = 0; bombCountdown = 0; base.Initialize(); }
// Reset the game: Called at beginning of new game public void ResetGame() { finalScore = currentScore; currentScore = 0; thePlayer = new Player(this, start); // Add player to game Components.Add(thePlayer); thePlayer.Health = 100; thePlayer.IsAlive = true; currentState = GameState.EndScreen; }