예제 #1
0
    /// <summary>
    /// Modifies the movement direction based on input. Broken up into single ifs so pressing opposing keys prevents you from moving.
    /// </summary>
    private void HandleInput()
    {
        if (InputUtil.Held(GlobalControls.input.Up))
        {
            ModifyMovementDirection(Directions.UP);
        }
        if (InputUtil.Held(GlobalControls.input.Down))
        {
            ModifyMovementDirection(Directions.DOWN);
        }

        if (InputUtil.Held(GlobalControls.input.Left))
        {
            ModifyMovementDirection(Directions.LEFT);
        }
        if (InputUtil.Held(GlobalControls.input.Right))
        {
            ModifyMovementDirection(Directions.RIGHT);
        }

        if (InputUtil.Pressed(GlobalControls.input.Cancel))
        {
            soul.setHalfSpeed(true);
        }
        else if (InputUtil.Released(GlobalControls.input.Cancel))
        {
            soul.setHalfSpeed(false);
        }
    }
예제 #2
0
 public void SetSoul(AbstractSoul s)
 {
     selfImg.color = s.color;
     soul          = s;
     // if still holding X keep the slow applied
     if (InputUtil.Held(GlobalControls.input.Cancel))
     {
         s.setHalfSpeed(true);
     }
 }