@Override
  public void act(float delta) {
    super.act(delta);

    if (TimeUtils.nanoTime() - lastCarTime > 3000000000f) spawnCar();

    Iterator<EnemyCar> iter = enemyCars.iterator();
    while (iter.hasNext()) {
      EnemyCar enemyCar = iter.next();
      if (enemyCar.getBounds().x + enemyCar.getWidth() <= 0) {
        iter.remove();
        removeActor(enemyCar);
      }
      if (enemyCar.getBounds().overlaps(playerCar.getBounds())) {
        iter.remove();
        if (enemyCar.getX() > playerCar.getX()) {
          if (enemyCar.getY() > playerCar.getY()) enemyCar.crash(true, true);
          else enemyCar.crash(true, false);
        } else {
          if (enemyCar.getY() > playerCar.getY()) enemyCar.crash(false, true);
          else enemyCar.crash(false, false);
        }
      }
    }
  }
  @Override
  public void act(float delta) {
    super.act(delta);

    lastUpdated += delta;

    if (lastUpdated >= TowerConsts.HUD_UPDATE_FREQUENCY) {
      lastUpdated = 0f;
      Player player = Player.instance();
      starRatingBar.setValue(player.getStarRating());

      if (dubai7StarWonder.isCompleted() && starRatingBar.getMaxValue() == 5) {
        starRatingBar.setMaxValue(7);
      }

      experienceLabel.setText(formatNumber(player.getExperience()));

      moneyLabel.setText(TowerConsts.CURRENCY_SYMBOL + formatNumber(player.getCoins()));
      moneyIncomeLabel.setText(
          TowerConsts.CURRENCY_SYMBOL + formatNumber(player.getCurrentIncome()));
      moneyExpensesLabel.setText(
          TowerConsts.CURRENCY_SYMBOL + formatNumber(player.getCurrentExpenses()));
      populationLabel.setText(
          formatNumber(player.getPopulationResidency())
              + "/"
              + formatNumber(player.getMaxPopulation()));
      employmentLabel.setText(
          formatNumber(player.getJobsFilled()) + "/" + formatNumber(player.getJobsMax()));

      pack();
    }
  }
Esempio n. 3
0
 /** Metodo act se ejecuta al igual que el render, es donde insertaremos la lógica. */
 @Override
 public void act(float delta) {
   super.act(delta);
   batch.begin();
   batch.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
   batch.end();
   // dynBacks.checkMillis();
 }
 @Override
 public void act(float delta) {
   super.act(delta);
   this.playbackLabel.setText((int) this.slider.getValue() + "%");
   this.playerGroup.player.setFrameSpeed((int) ((1000f / 60f) * (this.slider.getValue() / 100)));
   this.setAnimation();
   this.setDrawing();
 }
 @Override
 public void act(float delta) {
   super.act(delta);
 }