Ejemplo n.º 1
0
  @Override
  public boolean keyDown(int keyCode) {
    switch (keyCode) {
      case Keys.A:
      case Keys.LEFT:
        playerActor.dir = Dir.left;
        break;
      case Keys.D:
      case Keys.RIGHT:
        playerActor.dir = Dir.right;
        break;

      case Keys.W:
      case Keys.UP:
        if (playerActor.canJump()) {
          playerActor.jump = true;
        }
        break;
      case Keys.ESCAPE:
        Gdx.app.exit();
        break;

      case Keys.T:
        Bool.renderTiledMapTile = !Bool.renderTiledMapTile;
        break;
      default:
        break;
    }
    return super.keyDown(keyCode);
  }
Ejemplo n.º 2
0
  @Override
  public boolean keyUp(int keyCode) {
    switch (keyCode) {
      case Keys.W:
      case Keys.UP:
        playerActor.jump = false;
        break;
      case Keys.A:
      case Keys.D:
      case Keys.LEFT:
      case Keys.RIGHT:
        playerActor.dir = Dir.idle;
        break;

      default:
        break;
    }
    return super.keyUp(keyCode);
  }