Пример #1
0
 public virtual void HandleKeyboard(KeyboardState curState, KeyboardState prevState)
 {
     #if DEBUG
     if (curState.IsKeyUp(Keys.R) && prevState.IsKeyDown(Keys.R))
     {
         // reinitalise and reload the map from xml DEBUG
         mMapLoader.unloadBodies();
         mMapLoader = new Maps.MapLoader(mMapLoader.MapFile, mWorld);
         mMapLoader.loadMap(Content);
     }
     #endif
 }
Пример #2
0
        public void HandleKeyboard(KeyboardState state, KeyboardState prevState)
        {
            // We make it possible to rotate the circle body
            if (state.IsKeyDown(Keys.A))
                mPlayer1.moveLeft();

            if (state.IsKeyDown(Keys.D))
                mPlayer1.moveRight();

            if (state.IsKeyDown(Keys.W))
                mPlayer1.moveForward(gameTime, _view);

            if (state.IsKeyUp(Keys.D) && prevState.IsKeyDown(Keys.D))
                mPlayer1.stall();

            if (state.IsKeyUp(Keys.A) && prevState.IsKeyDown(Keys.A))
                mPlayer1.stall();

            if (state.IsKeyUp(Keys.F) && prevState.IsKeyDown(Keys.F))
                mPlayer1.fire();

            if (state.IsKeyDown(Keys.Space) && prevState.IsKeyUp(Keys.Space))
                mPlayer1.reset();
            #if DEBUG
            if (state.IsKeyUp(Keys.R) && prevState.IsKeyDown(Keys.R))
            {
                // reinitalise and reload the map from xml DEBUG
                mMapLoader.unloadBodies();
                mMapLoader = new Maps.MapLoader("../../../Maps/level1.xml", mWorld);
                mMapLoader.loadMap(Content);
            }
            #endif
        }