Example #1
0
        public void UpdateControlsActivity(GameTime gt)
        {
            newKeyboardState = Keyboard.GetState();

            if (newKeyboardState.IsKeyDown(Keys.Right))
            {
                theSpaceship.OnRightArrowClick();
            }

            if (newKeyboardState.IsKeyDown(Keys.Left))
            {
                theSpaceship.OnLeftArrowClick();
            }

            if (newKeyboardState.IsKeyDown(Keys.Space) && oldKeyboardState.IsKeyUp(Keys.Space))
            {
                theSpaceship.OnSpaceClick();
            }

            oldKeyboardState = newKeyboardState;
        }