Fixing syntax errors so the demo can run.

This commit is contained in:
Yong Bakos
2013-02-21 18:32:53 -07:00
parent 8a571315dd
commit 775870e585
2 changed files with 9 additions and 12 deletions
@@ -21,25 +21,20 @@ class CrazyParticle extends Particle {
void update() {
super.update();
// Increment rotation based on horizontal velocity
float theta_vel = (vel.x * vel.mag()) / 10.0f;
float theta_vel = (velocity.x * velocity.mag()) / 10.0f;
theta += theta_vel;
}
// Override timer
void timer() {
timer -= 0.5;
}
// Method to display
void render() {
void display() {
// Render the ellipse just like in a regular particle
super.render();
super.display();
// Then add a rotating line
pushMatrix();
translate(loc.x,loc.y);
translate(location.x,location.y);
rotate(theta);
stroke(255,timer);
stroke(255,lifespan);
line(0,0,25,0);
popMatrix();
}
@@ -1,4 +1,6 @@
// An ArrayList is used to manage the list of Particles
// An ArrayList is used to manage the list of Particles
// An Iterator is used to remove "dead" particles while iterating over the list
import java.util.Iterator;
class ParticleSystem {
@@ -42,4 +44,4 @@ class ParticleSystem {
}
}
}
}