private void CheckKeys(GameTime gameTime) { if (!_dying) { // Movement if (InputManager.Instace.KeyDown(Keys.Left) && Math.Abs(_knockbackAcceleration) < 1200f) { CharacterSprite.SetDirection(SpriteDirection.Left); _movement = -1.0f; } else if (InputManager.Instace.KeyDown(Keys.Right) && Math.Abs(_knockbackAcceleration) < 1200f) { CharacterSprite.SetDirection(SpriteDirection.Right); _movement = 1.0f; } _isJumping = InputManager.Instace.KeyDown(Keys.C); if (InputManager.Instace.KeyPressed(Keys.C) && _isOnGround) { CreateJumpParticles(); } // Attack if (!_isAttacking) { if (!_isAttacking && ((_isOnGround && InputManager.Instace.KeyPressed(Keys.X)) || (!_isOnGround && InputManager.Instace.KeyDown(Keys.X)))) { StartNormalAttack(); } if (InputManager.Instace.KeyPressed(Keys.Z) && !_isAttacking && !_dying) { RequestAttack(ShotAttack); } } // Run _running = InputManager.Instace.KeyDown(Keys.A); } }
private void CheckKeys(GameTime gameTime) { if (!_dying) { // Movement if (RequestingMoveLeft() && Math.Abs(_knockbackAcceleration) < 1200f) { CharacterSprite.SetDirection(SpriteDirection.Left); _movement = -1.0f; } else if (RequestingMoveRight() && Math.Abs(_knockbackAcceleration) < 1200f) { CharacterSprite.SetDirection(SpriteDirection.Right); _movement = 1.0f; } _isJumping = InputManager.Instace.Down(InputCommand.Jump); if (InputManager.Instace.Pressed(InputCommand.Jump) && _isOnGround) { CreateJumpParticles(); } // Attack if (!_isAttacking) { if (!_isAttacking && ((_isOnGround && InputManager.Instace.Pressed(InputCommand.Attack)) || (!_isOnGround && InputManager.Instace.Down(InputCommand.Attack)))) { StartNormalAttack(); } if (InputManager.Instace.Pressed(InputCommand.Shot) && !_isAttacking && !_dying) { RequestAttack(ShotAttack); } } } }