update of Nature of Code examples, need to do one more before 2.0

This commit is contained in:
Daniel Shiffman
2013-03-06 22:59:57 -05:00
parent 82c677ef33
commit 6b5521af3c
151 changed files with 15068 additions and 449 deletions
@@ -15,18 +15,18 @@ class ParticleSystem {
float r = random(1);
if (r < 0.5) {
particles.add(new Particle(origin));
} else {
}
else {
particles.add(new ParticleChild(origin));
}
}
void run() {
Iterator<Particle> it = particles.iterator();
while (it.hasNext()) {
Particle p = it.next();
for (int i = particles.size()-1; i >= 0; i--) {
Particle p = particles.get(i);
p.run();
if (p.isDead()) {
it.remove();
particles.remove(i);
}
}
}
@@ -34,4 +34,3 @@ class ParticleSystem {