Example #1
0
 public void checkPause() {
   if (Input.getKeyDown(Input.KEY_ESCAPE) && !checkGameOver() && !checkLevelEnded()) {
     pause = !pause;
     if (pause) {
       manager.alert(UIState.PAUSE);
     } else {
       manager.alert(UIState.GAME);
     }
   }
   if (manager.getOldState() == UIState.GAME) {
     pause = manager.isPaused();
   }
 }
Example #2
0
 @Override
 public void render(RenderingEngine engine) {
   engine.render(level);
   if (pause || gameOver || levelEnded) {
     engine.render(manager.getMainFrame(), true);
   }
 }
Example #3
0
 public boolean checkLevelEnded() {
   boolean res = GameplayManager.getInstance().isLevelEnded();
   if (res) {
     manager.alert(UIState.LEVEL_ENDED);
   }
   return res;
 }
Example #4
0
 public boolean checkGameOver() {
   boolean res = GameplayManager.getInstance().isGameOver();
   if (res) {
     manager.alert(UIState.GAME_OVER);
   }
   return res;
 }
Example #5
0
 @Override
 public void update() {
   GameplayManager.getInstance().update((Player) Level.getObjects().get(0));
   gameOver = checkGameOver();
   levelEnded = checkLevelEnded();
   checkPause();
   if (pause || gameOver || levelEnded) {
     manager.update();
   } else {
     level.input();
     level.update();
     ParticleMaster.update(camera);
   }
 }