Example #1
0
        public GameScreen(DataClasses.GameConfiguration gameConfig)
        {
            mWorld = new World(new Vector2(0, 2));
            mMapLoader = new Maps.MapLoader(gameConfig.MapName, mWorld);
            SpriteObjects.Ship ship = gameConfig.Ship;
            ship.ShipPosition = mMapLoader.shipStartPosP1;
            ship.World = mWorld;
            mPlayer1 = new ControllerAgents.LocalAgent(ship);

            _cameraZoom = new Vector3(0.5f, 0.5f, 0.5f);
        }
Example #2
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
 }
Example #3
0
 public BaseGame(DataClasses.GameConfiguration gameConfig)
 {
     mWorld = new World(new Vector2(0, 1f)); //0.5
     mMapLoader = new Maps.MapLoader(gameConfig.MapName, mWorld);
 }
Example #4
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
        }