Example #1
0
  @Override
  public void revive() {
    super.revive();

    speed.set(0);
    acc.set(0);
    dropInterval = 0;

    heap = null;
  }
Example #2
0
  @Override
  public void update() {
    super.update();

    visible = (heap == null || Dungeon.visible[heap.pos]);

    if (dropInterval > 0 && (dropInterval -= Game.elapsed) <= 0) {

      speed.set(0);
      acc.set(0);
      place(heap.pos);

      if (visible) {
        boolean water = Level.water[heap.pos];

        if (water) {
          GameScene.ripple(heap.pos);
        } else {
          int cell = Dungeon.level.map[heap.pos];
          water = (cell == Terrain.WELL || cell == Terrain.ALCHEMY);
        }

        if (!(heap.peek() instanceof Gold)) {
          Sample.INSTANCE.play(water ? Assets.SND_WATER : Assets.SND_STEP, 0.8f, 0.8f, 1.2f);
        }
      }
    }

    if (visible && glowing != null) {
      if (glowUp && (phase += Game.elapsed) > glowing.period) {

        glowUp = false;
        phase = glowing.period;

      } else if (!glowUp && (phase -= Game.elapsed) < 0) {

        glowUp = true;
        phase = 0;
      }

      float value = phase / glowing.period * 0.6f;

      rm = gm = bm = 1 - value;
      ra = glowing.red * value;
      ga = glowing.green * value;
      ba = glowing.blue * value;
    }
  }
  @Override
  public void update() {

    super.update();

    if (paused && listener != null) {
      listener.onComplete(curAnim);
    }

    if (flashTime > 0 && (flashTime -= Game.elapsed) <= 0) {
      resetColor();
    }

    boolean visible = getVisible();

    if (burning != null) {
      burning.setVisible(visible);
    }
    if (levitation != null) {
      levitation.setVisible(visible);
    }
    if (iceBlock != null) {
      iceBlock.setVisible(visible);
    }
    if (sleeping) {
      showSleep();
    } else {
      hideSleep();
    }

    if (controlled) {
      showMindControl();
    }

    if (emo != null) {
      emo.setVisible(visible);
    }
  }
 @Override
 public void kill() {
   super.kill();
   removeEmo();
 }