コード例 #1
0
ファイル: MainMenu.java プロジェクト: guykirs/SkyJumper
  @Override
  public void update(float deltaTime) {
    List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
    game.getInput().getKeyEvents();

    int len = touchEvents.size();
    for (int i = 0; i < len; i++) {
      TouchEvent event = touchEvents.get(i);
      touchPoint.set(event.x, event.y);
      guiCam.touchToWorld(touchPoint);

      if (event.type == TouchEvent.TOUCH_UP) {
        if (OverlapTester.pointInRectangle(playBounds, touchPoint)) {
          game.setScreen(new GameScreen(game));
          return;
        }
        if (OverlapTester.pointInRectangle(highscoresBounds, touchPoint)) {
          game.setScreen(new HighscoreScreen(game));
          return;
        }
        if (OverlapTester.pointInRectangle(helpBounds, touchPoint)) {
          game.setScreen(new HelpScreen(game));
          return;
        }
        if (OverlapTester.pointInRectangle(soundBounds, touchPoint)) {
          Settings.soundEnabled = !Settings.soundEnabled;
        }
      }
    }
  }
コード例 #2
0
  private void updateRunning(float deltaTime) {
    List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
    int len = touchEvents.size();
    for (int i = 0; i < len; i++) {
      TouchEvent event = touchEvents.get(i);
      if (event.type != TouchEvent.TOUCH_UP) continue;

      touchPoint.set(event.x, event.y);
      guiCam.touchToWorld(touchPoint);

      if (OverlapTester.pointInRectangle(pauseBounds, touchPoint)) {
        Assets.playSound(Assets.clickSound);
        state = GAME_PAUSED;
        return;
      }
    }

    world.update(deltaTime, game.getInput().getAccelX());
    if (world.score != lastScore) {
      lastScore = world.score;
      scoreString = "" + lastScore;
    }
    if (world.state == World.WORLD_STATE_NEXT_LEVEL) {
      state = GAME_LEVEL_END;
    }
    if (world.state == World.WORLD_STATE_GAME_OVER) {
      state = GAME_OVER;
      if (lastScore >= Settings.highscores[4]) scoreString = "new highscore: " + lastScore;
      else scoreString = "score: " + lastScore;
      Settings.addScore(lastScore);
      Settings.save(game.getFileIO());
    }
  }
コード例 #3
0
  @Override
  public void update(float deltaTime) {
    List<TouchEvent> events = game.getInput().getTouchEvents();
    int len = events.size();
    for (int i = 0; i < len; i++) {
      TouchEvent event = events.get(i);
      if (event.type != TouchEvent.TOUCH_UP) continue;

      guiCam.touchToWorld(touchPoint.set(event.x, event.y));
      if (OverlapTester.pointInRectangle(playBounds, touchPoint)) {
        Assets.playSound(Assets.clickSound);
        game.setScreen(new GameScreen(game));
      }
      if (OverlapTester.pointInRectangle(settingsBounds, touchPoint)) {
        Assets.playSound(Assets.clickSound);
        game.setScreen(new SettingsScreen(game));
      }
    }
  }
コード例 #4
0
  private void updatePaused() {
    List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
    int len = touchEvents.size();
    for (int i = 0; i < len; i++) {
      TouchEvent event = touchEvents.get(i);
      if (event.type != TouchEvent.TOUCH_UP) continue;

      touchPoint.set(event.x, event.y);
      guiCam.touchToWorld(touchPoint);

      if (OverlapTester.pointInRectangle(resumeBounds, touchPoint)) {
        Assets.playSound(Assets.clickSound);
        state = GAME_RUNNING;
        return;
      }

      if (OverlapTester.pointInRectangle(quitBounds, touchPoint)) {
        Assets.playSound(Assets.clickSound);
        game.setScreen(new MainMenuScreen(game));
        return;
      }
    }
  }
コード例 #5
0
ファイル: HelpScreen4.java プロジェクト: guykirs/SkyJumper
  @Override
  public void update(float deltaTime) {
    List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
    game.getInput().getKeyEvents();
    int len = touchEvents.size();
    for (int i = 0; i < len; i++) {
      TouchEvent event = touchEvents.get(i);
      touchPoint.set(event.x, event.y);
      guiCam.touchToWorld(touchPoint);

      if (event.type == TouchEvent.TOUCH_UP) {
        if (OverlapTester.pointInRectangle(nextBounds, touchPoint)) {
          Assets.playSound(Assets.clickSound);
          game.setScreen(new HelpScreen5(game));
          return;
        }
      }
    }
  }