Example #1
0
  public void updateButtonClick() {
    if (Gdx.input.justTouched()) {
      Rectangle mousePos =
          new Rectangle(Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY(), 1, 1);

      for (Ent e : getEnts()) {
        if (e.getName().contains("btn") && mousePos.overlaps(e.getPosBox())) {
          Aosa.getGlobal().getSoundByName("click").getSound().play();
          if (e.getName().equals("btnExit")) {
            Gdx.app.exit();
          } else if (e.getName().equals("btnPlay")) {
            Aosa.getGlobal().setCurrentMenu(Aosa.getGlobal().getMenuByName("load"));
            LoadGameInstance.load("sandbox");
          }
        }
      }
    }
  }
Example #2
0
 public void checkForEnemies() {
   boolean foundSomethingToAttack = false;
   for (Grunt g : Aosa.getGlobal().getGame().getWorld().getGrunts()) {
     if (this.getPosBox().getX() >= g.getPosBox().getX() - this.getSightDistance()
         && this.getPosBox().getX() <= g.getPosBox().getX() + this.getSightDistance()) {
       foundSomethingToAttack = true;
       this.setPrevState(currentState);
       this.setCurrentState(STATE.ATTACKING);
       targetGrunt = g;
       break;
     }
   }
 }
Example #3
0
 public void updateDeath() {
   Aosa.getGlobal().getCurrentMenu().setCurrentSubMenu(null);
   Aosa.getGlobal().setCurrentMenu(Aosa.getGlobal().getMenuByName("main"));
   Aosa.getGlobal().setBackMenu(null);
   Aosa.getGlobal().setGame(null);
 }