/// <summary>Enables going to the next level.</summary>
 public override void HandleInput(InputHelper inputHelper)
 {
     if (!(inputHelper.KeyPressed(Keys.Space) || inputHelper.ControlerButtonPressed(Buttons.A)))
         return;
     GameEnvironment.GameStateManager.SwitchTo("playingState");
     (playingState as PlayingState).NextLevel();
 }
 /// <summary>Enables retrying the level.</summary>
 public override void HandleInput(InputHelper inputHelper)
 {
     if (!(inputHelper.KeyPressed(Keys.Space) || inputHelper.ControlerButtonPressed(Buttons.A)))
     {
         return;
     }
     playingState.Reset();
     GameEnvironment.GameStateManager.SwitchTo("playingState");
 }
Пример #3
0
 /// <summary>Handle user input.</summary>
 public override void HandleInput(InputHelper inputHelper)
 {
     float walkingSpeed = 400;
     if (walkingOnIce)
         walkingSpeed *= 1.5f;
     if (!isAlive)
         return;
     if (inputHelper.IsKeyDown(Keys.Left) || inputHelper.IsKeyDown(Keys.A) || inputHelper.IsControlerButtonDown(Buttons.DPadLeft) || inputHelper.GetLeftControlerStick() == Direction.Left)
         velocity.X = -walkingSpeed;
     else if (inputHelper.IsKeyDown(Keys.Right) || inputHelper.IsKeyDown(Keys.D) || inputHelper.IsControlerButtonDown(Buttons.DPadRight) || inputHelper.GetLeftControlerStick() == Direction.Right)
         velocity.X = walkingSpeed;
     else if (!walkingOnIce && isOnTheGround)
         velocity.X = 0.0f;
     if (velocity.X != 0.0f)
         Mirror = velocity.X < 0;
     if ((inputHelper.KeyPressed(Keys.Up) || inputHelper.KeyPressed(Keys.W) || inputHelper.ControlerButtonPressed(Buttons.DPadUp) || inputHelper.ControlerButtonPressed(Buttons.A)) && isOnTheGround)
         Jump();
     if (inputHelper.KeyPressed(Keys.Space) || inputHelper.ControlerButtonPressed(Buttons.X))
         Shoot();
 }
Пример #4
0
    /// <summary>Handle user input.</summary>
    public override void HandleInput(InputHelper inputHelper)
    {
        float walkingSpeed = 400;

        if (walkingOnIce)
        {
            walkingSpeed *= 1.5f;
        }
        if (!isAlive)
        {
            return;
        }
        if (inputHelper.IsKeyDown(Keys.Left) || inputHelper.IsKeyDown(Keys.A) || inputHelper.IsControlerButtonDown(Buttons.DPadLeft) || inputHelper.GetLeftControlerStick() == Direction.Left)
        {
            velocity.X = -walkingSpeed;
        }
        else if (inputHelper.IsKeyDown(Keys.Right) || inputHelper.IsKeyDown(Keys.D) || inputHelper.IsControlerButtonDown(Buttons.DPadRight) || inputHelper.GetLeftControlerStick() == Direction.Right)
        {
            velocity.X = walkingSpeed;
        }
        else if (!walkingOnIce && isOnTheGround)
        {
            velocity.X = 0.0f;
        }
        if (velocity.X != 0.0f)
        {
            Mirror = velocity.X < 0;
        }
        if ((inputHelper.KeyPressed(Keys.Up) || inputHelper.KeyPressed(Keys.W) || inputHelper.ControlerButtonPressed(Buttons.DPadUp) || inputHelper.ControlerButtonPressed(Buttons.A)) && isOnTheGround)
        {
            Jump();
        }
        if (inputHelper.KeyPressed(Keys.Space) || inputHelper.ControlerButtonPressed(Buttons.X))
        {
            Shoot();
        }
    }