Beispiel #1
0
 /// <summary>
 /// Updates the state of the game. This method checks the GameScreen.IsActive
 /// property, so the game will stop updating when the pause menu is active,
 /// or if you tab away to a different application.
 /// </summary>
 public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                             bool coveredByOtherScreen)
 {
     base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
     if (IsActive)
     {
         if (stage.paused)
         {
             stage.startTimers();
         }
         stage.addStageTime(gameTime.ElapsedGameTime);
         // Add timer restart code after pause.
         stage.updateBackground(2.3f);
         Collisions.updateCollisions(player1, stage.getEnemyList(), stage.getFoodList(), foods, viewportRect);
         player1.Update(gameTime);
         stage.updateList(gameTime);
         foreach (Enemy e in stage.getEnemyList())
         {
             e.getPC(player1);
             e.Update(gameTime, enemyFieldBound, viewportRect);
         }
         foreach (Food f in stage.getFoodList())
         {
             f.Update(gameTime, enemyFieldBound, viewportRect);
         }
         if (player1.getLives() == 0 && player1.doneAnimating)
         {
             ScreenManager.AddScreen(new GameOverScreen(player1), ControllingPlayer);
             stage.stopTimers();
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Updates the state of the game. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                    bool coveredByOtherScreen)
        {
            Stage1 s = (Stage1)stage;

            if (s.getBoss() != null)
            {
                Collisions.checkSpecialCollisions(player1, s.getBoss(), viewportRect);
            }
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
            if (stage.end && IsActive)
            {
                // Temporary Test
                ScreenManager.AddScreen(new BackgroundScreen(), null);
                ScreenManager.AddScreen(new StageEndScreen(player1, true, 0), ControllingPlayer);
                stage.stopTimers();
            }
        }