Beispiel #1
0
        public void Update(GameTime gameTime, GameWindow gameWindow, Platforms platforms, ref int shift, PlayerBullets playerBullets,
                           ContentManager content, Enemies enemies, Bullets bullets)
        {
            playerAnimation.Update(gameTime);
            GetHurt(enemies, bullets);
            KeyboardState newState = Keyboard.GetState();

            SetPlayerDirection(oldState, newState);
            PlayerJump(oldState, newState, gameWindow, platforms, shift);
            SetVelocity(gameWindow, platforms, ref shift, gameTime);
            Shoot(oldState, newState, playerBullets, content);
            if (canMoveRight(gameWindow, platforms, shift) && newState.IsKeyDown(Keys.Right))
            {
                position.X += velocity.X;
                changeShift(ref shift, gameWindow);
            }
            if (canMoveLeft(gameWindow, platforms, shift) && newState.IsKeyDown(Keys.Left))
            {
                position.X -= velocity.X;
                changeShift(ref shift, gameWindow);
            }
            oldState = newState;
            EndGame();
        }
Beispiel #2
0
 private void GetHurt(Enemies enemies, Bullets bullets)
 {
     this.HP -= enemies.DamageDealt(this, bullets);
 }