Beispiel #1
0
  @Override
  public boolean touchDragged(int screenX, int screenY, int pointer) {
    if (!Gdx.app.getType().equals(ApplicationType.Android)) return false;

    // fix for dragging past the touch zones
    if (screenX < width / 2 && screenY < height / 2) controller.leftReleased();
    if (screenX > width / 2 && screenY < height / 2) controller.rightReleased();
    if (screenX > width / 2 && screenY > height / 2) {
      controller.leftReleased();
      controller.rightPressed();
    }
    if (screenX < width / 2 && screenY > height / 2) {
      controller.rightReleased();
      controller.leftPressed();
    }
    return true;
  }
Beispiel #2
0
 @Override
 public boolean keyUp(int keycode) {
   if (keycode == Keys.LEFT) controller.leftReleased();
   if (keycode == Keys.RIGHT) controller.rightReleased();
   if (keycode == Keys.Z) controller.jumpReleased();
   if (keycode == Keys.X) controller.fireReleased();
   return true;
 }
Beispiel #3
0
 @Override
 public boolean touchUp(int screenX, int screenY, int pointer, int button) {
   if (!Gdx.app.getType().equals(ApplicationType.Android)) return false;
   if (screenX < width / 2 && screenY > height / 2) controller.leftReleased();
   if (screenX > width / 2 && screenY > height / 2) controller.rightReleased();
   if (screenX < width / 2 && screenY < height / 2) controller.jumpReleased(); // top left
   // if (screenX > width /2 && screenY < height /2) controller.fireReleased(); // top right
   if (screenX > width / 2 && screenY < height / 2) controller.jumpReleased(); // top right
   return true;
 }