Пример #1
0
        private void UpdateKyeboardAndMouce(ref Vector2 movement)
        {
            Vector2 camera = Camera2D.GetInstance().Position - new Vector2(600, 450);

            if (_canUp)
            {
                if (KeyboardObject.KeyUpPressed())
                {
                    movement.Y             -= _sprite.SpeedY;
                    _weapon.WeaponSprite.Y -= _sprite.SpeedY;
                }
            }
            if (_canDown)
            {
                if (KeyboardObject.KeyDownPressed())
                {
                    movement.Y             += _sprite.SpeedY;
                    _weapon.WeaponSprite.Y += _sprite.SpeedY;
                }
            }
            if (_canRight)
            {
                if (KeyboardObject.KeyRightPressed())
                {
                    _isMoveRight = true;
                    movement.X  += _sprite.SpeedX;
                    //_sprite.X += _sprite.SpeedX;
                    _weapon.WeaponSprite.X += _sprite.SpeedX;
                }
            }
            if (_canLeft)
            {
                if (KeyboardObject.KeyLeftPressed())
                {
                    _isMoveRight            = false;
                    movement.X             -= _sprite.SpeedX;
                    _weapon.WeaponSprite.X -= _sprite.SpeedX;
                }
            }
            if (MouseObject.LeftRelease)
            {
                _weapon.Attack(MouseObject.Position + camera);
            }
        }