Added updated examples from branch

This commit is contained in:
codeanticode
2012-05-09 23:58:30 +00:00
parent 9f847df04c
commit a586b8f0ae
109 changed files with 19979 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
class ParticleSystem {
ArrayList<Particle> particles;
PShape particleShape;
ParticleSystem(int n) {
particles = new ArrayList<Particle>();
particleShape = createShape(PShape.GROUP);
for (int i = 0; i < n; i++) {
Particle p = new Particle();
particles.add(p);
particleShape.addChild(p.getShape());
}
}
void update() {
for (Particle p : particles) {
p.update();
}
}
void setEmitter(float x, float y) {
for (Particle p : particles) {
if (p.isDead()) {
p.rebirth(x, y);
}
}
}
void display() {
shape(particleShape);
}
}