Ejemplo n.º 1
0
 @Override
 public void update(float delta) {
   if (!active) return;
   timer += delta;
   float a = timer / duration;
   if (a <= 1) {
     position.x = Interpolation.linear.apply(start.x, target.x, a);
     position.y =
         Interpolation.linear.apply(start.y, target.y, a) + ((1 + MathUtils.sinDeg(a * 180)) * 2);
     light.setDistance(1.5f + MathUtils.random(-.25f, .25f));
   } else {
     effect.allowCompletion();
     for (ParticleEmitter emitter : effect.getEmitters()) {
       emitter.setContinuous(false);
     }
     light.setDistance(light.getDistance() * 0.95f);
   }
   light.setPosition(position);
   effect.setPosition(position.x, position.y);
   effect.update(delta);
   if (effect.isComplete()) {
     Gdx.app.log("", "reset");
     FlamingRock.pool.free(this);
   }
 }
Ejemplo n.º 2
0
  public void init(float x, float y, float tx, float ty) {
    position.set(x, y);
    start.set(position);
    target.set(tx, ty);
    effect.reset();
    duration = target.dst(position) / 6;
    active = true;
    light.setActive(true);
    light.setPosition(x, y);

    for (ParticleEmitter emitter : effect.getEmitters()) {
      emitter.setContinuous(true);
    }
  }