class ParticleX { public float x, y, direction, speed, gravity, gravity_direction, gravity_current; private float a; public boolean alive; public ParticleX() { alive = true; a = 255; x = 0; y = 0; direction = 0; speed = 0; gravity = 0; gravity_current = 0; gravity_direction = 0; } public void step() { if(speed > 0 || speed < 0) { float[] c = move_in_direction(x, y, direction, speed); x = c[0]; y = c[1]; } // Apply gravity if(gravity > 0 || gravity < 0) { gravity_current += gravity; float[] c = move_in_direction(x, y, gravity_direction, gravity_current); x = c[0]; y = c[1]; } // Do user-defined stuff customstep(); } private void customstep() { } public void draw(float R, float G, float B) { stroke(R,G,B, a); fill(R,G,B,a); a -= 3; if(a < 0) alive = false; ellipse(x, y, 5, 5); } }