public class Particle { float x, y, z; float vx, vy, vz; boolean alive; PImage tex; color ti; public Particle( float x, float y, float z, float vx, float vy, float vz, PImage tex, color ti ) { this.tex = tex; this.x = x; this.y = y; this.z = z; this.vx = vx; this.vy = vy; this.vz = vz; this.ti = ti; alive = true; } public Particle( float x, float y, float z, float vx, float vy, float vz, PImage tex ) { this( x, y, z, vx, vy, vz, tex, color( 255, 255, 255 )); } public void update() { x += vx * 0.1f; y += vy * 0.1f; z += vz * 0.1f; vy += 0.1; if (y > 600) { alive = false; } } public void draw( float alph ) { pushMatrix(); translate( x, y, z ); rotateY( alph ); textureMode(NORMALIZED); tint(ti); beginShape(); texture( tex ); vertex( -20, -20, 0, 0, 0 ); vertex( -20, 20, 0, 0, 1 ); vertex( 20, 20, 0, 1, 1 ); vertex( 20, -20, 0, 1, 0 ); endShape(CLOSE); popMatrix(); } public boolean isAlive() { return alive; } }