Esempio n. 1
0
        // method for moving the ship
        private void moveShip()
        {
            KeyboardState state = Keyboard.GetState();

            //Move left
            if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left) && myShip._pos.X > 0)
            {
                myShip.move(Ship.Direction.Left);
            }
            // Move Right
            else if (state.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right) && myShip._pos.X < viewPort.Width - 120)
            {
                myShip.move(Ship.Direction.Right);
            }
        }