Esempio n. 1
0
  public boolean touchUp(int x, int y, int pointer, int button) {
    if (Gdx.app.getType().equals(Application.ApplicationType.Android)) {
      if (left.contains(x, (y - height) * -1)) {
        controller.leftReleased();
      }

      if (right.contains(x, (y - height) * -1)) {
        controller.rightReleased();
      }

      if (jump.contains(x, (y - height) * -1)) {
        controller.jumpReleased();
      }
      return true;
    }
    return false;
  }
Esempio n. 2
0
  public boolean touchDragged(int x, int y, int pointer) {
    if (Gdx.app.getType().equals(Application.ApplicationType.Android)) {
      if (controller.isLeftDown()
          && !left.contains(x, (y - height) * -1)
          && controller.leftPointer == pointer) {
        controller.leftReleased();
      }
      if (controller.isRightDown()
          && !right.contains(x, (y - height) * -1)
          && controller.rightPointer == pointer) {
        controller.rightReleased();
      }
      if (controller.isJumpDown()
          && !jump.contains(x, (y - height) * -1)
          && controller.jumpPointer == pointer) {
        controller.jumpReleased();
      }

      if (!controller.isLeftDown()
          && left.contains(x, (y - height) * -1)
          && controller.leftPointer == -1) {
        controller.leftPressed(pointer);
      }

      if (!controller.isRightDown()
          && right.contains(x, (y - height) * -1)
          && controller.rightPointer == -1) {
        controller.rightPressed(pointer);
      }

      if (!controller.isJumpDown()
          && jump.contains(x, (y - height) * -1)
          && controller.jumpPointer == -1) {
        controller.jumpPressed(pointer);
      }
      return true;
    }
    return false;
  }