Exemplo n.º 1
0
Arquivo: Player.cs Projeto: hantor/EOD
        public override void Update(GameTime gameTime)
        {
            if (_iKeyboardManagerService.IsKeyPressed(Keys.Up) && _iKeyboardManagerService.IsKeyReleased(Keys.Down))
            {
                SetDirectionY(-1.0f);
            }
            else if (_iKeyboardManagerService.IsKeyPressed(Keys.Down) && _iKeyboardManagerService.IsKeyReleased(Keys.Up))
            {
                SetDirectionY(1.0f);
            }
            else
            {
                SetDirectionY(0.0f);
            }

            if (_iKeyboardManagerService.IsKeyPressed(Keys.Left) && _iKeyboardManagerService.IsKeyReleased(Keys.Right))
            {
                SetDirectionX(-1.0f);
            }
            else if (_iKeyboardManagerService.IsKeyPressed(Keys.Right) && _iKeyboardManagerService.IsKeyReleased(Keys.Left))
            {
                SetDirectionX(1.0f);
            }
            else
            {
                SetDirectionX(0.0f);
            }

            base.Update(gameTime);
        }