Example #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);
     }
   }
 }
Example #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);
      }
    }
  }
Example #3
0
 public void birthParticle(LingerParticle p) {
   if (p.lifetime >= 10) {
     float angle = 0;
     angle = random(-HALF_PI / 2, HALF_PI / 2); // random turns
     // if ((int)(random(0,2))==0) angle = -HALF_PI; else angle = HALF_PI;    //orthogonal turns
     LingerParticle n =
         (LingerParticle)
             p.rotatedCopy(
                 p.pos,
                 1F + pRandom(-0.1F, 0.1F, 30),
                 angle,
                 0.7F + pRandom(-0.05F, 0.05F, 10),
                 p.color,
                 0.75F + pRandom(-0.15F, 0.15F, 20));
     particles.add(n);
   }
 }