public VindicetisExSimius(final TriviazoGame game) {
   super(game);
   game.getMusicManager().play(TriviazoMusic.TENSION_IS_RISING);
   timer = new Timer();
   timer.scheduleTask(task, 0F, intervalSeconds);
   timer.start();
 }
  @Override
  public void fileChanged(FileHandle file) {
    String relativePath = fileAccess.relativizeToAssetsFolder(file);

    if (ProjectPathUtils.isTexture(relativePath, file.extension())) {
      cacheWaitTimer.clear();
      cacheWaitTimer.scheduleTask(
          new Task() {
            @Override
            public void run() {
              updateCache();
            }
          },
          0.5f);
    }

    if (ProjectPathUtils.isTextureAtlas(file, relativePath)) {
      atlasWaitTimer.clear();
      cacheWaitTimer.scheduleTask(
          new Task() {
            @Override
            public void run() {
              updateAtlas(file);
            }
          },
          0.5f);
    }
  }
Beispiel #3
0
 protected void scheduleKeyRepeatTask(int keycode) {
   if (!keyRepeatTask.isScheduled() || keyRepeatTask.keycode != keycode) {
     keyRepeatTask.keycode = keycode;
     keyRepeatTask.cancel();
     Timer.schedule(keyRepeatTask, keyRepeatInitialTime, keyRepeatTime);
   }
 }
Beispiel #4
0
    Caret(float holdDelay, float blinkDelay) {
      if (holdDelay < 0.1f) {
        throw new IllegalArgumentException("holdDelay should be >= 0.1f");
      }

      if (blinkDelay < 0.1f) {
        throw new IllegalArgumentException("blinkDelay should be >= 0.1f");
      }

      Pixmap solidColorPixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
      solidColorPixmap.setColor(1.0f, 1.0f, 1.0f, 1.0f);
      solidColorPixmap.fill();
      underlineBackgroundTexture = new Texture(solidColorPixmap);
      solidColorPixmap.dispose();
      solidColorPixmap = null;

      this.holdDelay = holdDelay;
      this.blinkDelay = blinkDelay;

      this.isVisible = true;

      TIMER = new Timer();
      BLINK_TASK =
          new Timer.Task() {
            @Override
            public void run() {
              Caret.this.setVisible(!Caret.this.isVisible());
            }
          };

      TIMER.start();
      setVisible(true);
    }
 public void setActivePlayer(int player) {
   screen.setActivePlayer(player);
   if (player == pid) {
     if (reminderTask.isScheduled()) return;
     turnReminder.scheduleTask(reminderTask, REMINDER_INTERVAL, REMINDER_INTERVAL);
   } else cancelReminder();
 }
Beispiel #6
0
 public Retard(Object objecte, float temps) {
   Timer.schedule(
       new Timer.Task() {
         @Override
         public void run() {
           ((IRetard) objecte).canviEstat();
         }
       },
       temps);
 }
 private void disposeCacheLater(final TextureAtlas oldCache) {
   Timer.instance()
       .scheduleTask(
           new Task() {
             @Override
             public void run() {
               if (oldCache != null) oldCache.dispose();
             }
           },
           0.5f);
 }
        @Override
        public void run() {
          seconds -= 1;
          lblTimer.setText("Tiempo: " + seconds);
          if (seconds <= 0) {
            checkQuestions(-1);
          }

          if ((correct + incorrect) >= maxQuestions) {
            timer.stop();
            cancel();
          }
        }
Beispiel #9
0
  public void update(float delta) {
    if (isDead()) {
      if (hasInventory() && inventory.hasItems()) {
        inventory.clear();
      }

      if (!reset) {
        hidden = true;
        reset = true;
        Timer.schedule(run, 1F);
      }
    }

    if (!isHidden()) {
      updateEntity(delta);
    }
  }
Beispiel #10
0
  public void hitright() {

    if (hit) {
    } else {
      body.setTransform(body.getPosition().x + 5, body.getPosition().y + 7, 1.5f);
      rotation = 90;

      Timer.schedule(
          new com.badlogic.gdx.utils.Timer.Task() {
            @Override
            public void run() {
              body.setTransform(body.getPosition().x - 5, body.getPosition().y - 7, 0f);
              rotation = 0;
              hit = false;
            }
          },
          0.2f //    (delay)
          //    (seconds)
          );
    }
    hit = true;
  }
 public SplashScreen() {
   if (GameConstants.currentMusic != null) {
     GameConstants.currentMusic.stop();
     GameConstants.currentMusic.dispose();
   }
   GameConstants.currentMusic = Gdx.audio.newSound(Gdx.files.internal("menu.mp3"));
   long id = GameConstants.currentMusic.play(GameConstants.MUSIC_VOLUME);
   GameConstants.currentMusic.setLooping(id, true);
   splashScreenTime = 5;
   spriteBatch = new SpriteBatch();
   background1 = new Texture("seems-legit-tunnel.jpg");
   background2 = new Texture("seemslegit2.jpg");
   background3 = new Texture("seemslegit3.jpg");
   choice = MathUtils.random(0, 2);
   Timer.schedule(
       new Timer.Task() {
         @Override
         public void run() {
           nextGameScreen = new MenuScreen();
           screenDone = true;
         }
       },
       splashScreenTime);
 }
Beispiel #12
0
 void setVisible(boolean b) {
   this.isVisible = b;
   BLINK_TASK.cancel();
   TIMER.schedule(BLINK_TASK, getHoldDelay(), getBlinkDelay());
 }
  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(1F, 1F, 1F, 1F);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.begin();
    batch.draw(Assets.background, 0, 0, W, H);
    batch.end();

    switch (state) {
      case PAUSE:
        batch.begin();
        batch.draw(
            Assets.avoid,
            (W / 2) - (Assets.avoid.getWidth() / 2),
            H - (augH + Assets.avoid.getHeight()));
        batch.draw(Assets.touch, (W / 2) - (Assets.touch.getWidth() / 2), augH);
        batch.draw(Assets.player, player.getPosition().x, player.getPosition().y);
        batch.end();
        Timer.schedule(
            new Task() {
              @Override
              public void run() {
                touch();
              }
            },
            0.3f);

        break;
      case RUN:
        if (playing) {
          if (gameover == false) {
            time += Gdx.graphics.getDeltaTime();
            meteorIterator = meteor.iterator();
            while (meteorIterator.hasNext()) {
              Meteor cur = meteorIterator.next();
              cur.update();
              batch.begin();
              batch.draw(
                  Assets.meteor,
                  cur.getPosition().x,
                  cur.getPosition().y,
                  Assets.meteor.getWidth() / 2f,
                  Assets.meteor.getHeight() / 2f,
                  Assets.meteor.getWidth(),
                  Assets.meteor.getHeight(),
                  1,
                  1,
                  cur.getMetSp().getRotation(),
                  0,
                  0,
                  Assets.meteor.getWidth(),
                  Assets.meteor.getHeight(),
                  false,
                  false);
              batch.end();
              cur.getMetSp().rotate(8f);
              if (Intersector.overlaps(cur.getmBounds(), player.getpBounds())) {
                gameover = true;
              }
            }
            enemyIterator = enemy.iterator();
            enemyIterator = enemy.iterator();
            while (enemyIterator.hasNext()) {
              Enemy cur = enemyIterator.next();
              cur.update();
              batch.begin();
              batch.draw(
                  Assets.enemy1,
                  cur.getPosition().x,
                  cur.getPosition().y,
                  scX / 2f,
                  scY / 2f,
                  scX,
                  scY,
                  1,
                  1,
                  cur.getRotate().getRotation());
              batch.end();
              cur.getRotate().rotate(-5f);
              if (Intersector.overlaps(cur.getBounds(), player.getpBounds())) {
                gameover = true;
              }
            }
            batch.begin();
            if (time > 40) {
              e2.update();
              batch.draw(Assets.enemy2, e2.getPosition().x, e2.getPosition().y);
              if (Intersector.overlaps(player.getpBounds(), e2.getBounds())) {
                gameover = true;
              }
            }
            if (Assets.H && !Assets.N) {
              if (time > 80) {
                e4.update();
                batch.draw(Assets.enemy2, e4.getPosition().x, e4.getPosition().y);
                if (Intersector.overlaps(player.getpBounds(), e2.getBounds())) {
                  gameover = true;
                }
              }
            }
            batch.draw(Assets.player, player.getPosition().x, player.getPosition().y);
            batch.end();
          } else {
            if (Assets.N) {
              Assets.setBestTime(time, true);
            } else {
              Assets.setBestTime(time, false);
            }
            Assets.setCurrentTime(time);
            exp.currentFrame = exp.anime.getKeyFrame(delta, false);
            batch.begin();
            batch.draw(exp.currentFrame, player.getPosition().x, player.getPosition().y);
            batch.end();
            if (!Assets.boom.isPlaying()) {
              Assets.boom.play();
            }
            Timer.schedule(
                new Task() {
                  @Override
                  public void run() {
                    playing = false;
                  }
                },
                0.7f);
          }
        } else {
          game.setScreen(new Replay(game));
        }

        if (gameover == false) {
          player.movement();
          player.update();
        } else if (gameover) {
          Assets.bgm.stop();
        }
        break;
    }
  }
 @Override
 public final void gameOver() {
   timer.stop();
   game.setScreen(new GameOverScreen(game, score));
 }
Beispiel #15
0
  protected void decreaseTimeLeft() {
    if (timeLeft >= 1) timeLeft -= 1;

    Timer.schedule(dtlTask, 1);
  }
 private void cancelReminder() {
   reminderTask.cancel();
   turnReminder.clear();
 }