예제 #1
0
 public void Update(WalkingPlayer player)
 {
     if (inputHandler.WasButtonPressed(Keys.Space))
     {
         player.Interact();
     }
     if (inputHandler.IsButtonHeld(Keys.W) || inputHandler.WasButtonPressed(Keys.W))
     {
         player.MoveUp();
     }
     else if (inputHandler.IsButtonHeld(Keys.S) || inputHandler.WasButtonPressed(Keys.S))
     {
         player.MoveDown();
     }
     else if (inputHandler.IsButtonHeld(Keys.A) || inputHandler.WasButtonPressed(Keys.A))
     {
         player.MoveLeft();
     }
     else if (inputHandler.IsButtonHeld(Keys.D) || inputHandler.WasButtonPressed(Keys.D))
     {
         player.MoveRight();
     }
     else
     {
         player.Stop();
     }
 }
예제 #2
0
        protected override void Initialize()
        {
            base.Initialize();
            this.CurrentState = GameState.World;
            SwitchSong();
            Point         gameSize  = new Point(17, 23);
            World         gameWorld = new World(gameSize, Content.Load <Texture2D>("BaseTile"));
            WalkingPlayer player    = new WalkingPlayer(this, gameWorld);

            walkingScene = new WalkingScene(this, gameWorld, player);
            battleScene  = null;
            menuScene    = null;
        }