Ejemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            controller.Update(player, gameTime, sprites);
            controller2.Update(player2, gameTime, sprites);

            player.Update(ScreenManager.Instance.Dimensions, gameTime, Content);

            foreach (Entity s in sprites)
            {
                if (s is Pillow)
                {
                    Pillow p = (Pillow)s;
                    if (p.holding)
                    {
                        Rectangle playerHolding = new Rectangle(player.SpritePosition.X, player.SpritePosition.Y, 30, 20);
                        playerHolding.Offset(-30, 0);
                        s.SpritePosition = playerHolding;
                    }
                }
            }

            if (timer > 0)
            {
                timer -= gameTime.ElapsedGameTime.TotalSeconds;
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                LevelScreen s = this;
                ScreenManager.Instance.ChangeScreen(new PauseScreen(s), true);
                timer = 0.2;
            }

            if (player.health <= 0 || player2.health <= 0)
            {
                ScreenManager.Instance.ChangeScreen(new DeathScreen(), true);
            }
        }
Ejemplo n.º 2
0
 public PauseScreen(LevelScreen levelScreen)
 {
     this.levelScreen = levelScreen;
 }