Esempio n. 1
0
 public void resurrect() {
   for (int i = particles.size() - 1; i >= 0; i--) {
     LingerParticle p = particles.get(i);
     if (p.shouldDestroy()) {
       particles.remove(i);
       // create a new one to replace the old (or resurrect it?)
       createParticle(640, 360);
     }
   }
 }
Esempio n. 2
0
  public void birth() {
    for (int i = particles.size() - 1; i >= 0; i--) {
      LingerParticle p = particles.get(i);

      if (p.isDead() && !p.hasBirthed) {
        // create a new ones where the old one died
        int numParticles = (int) (random(2, 4));

        for (int j = 0; j < numParticles; j++) birthParticle(p);

        p.hasBirthed = true;
      }

      if (p.shouldDestroy()) {
        particles.remove(i);
      }
    }
  }