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); } } }
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); } } }