float padding = 40; Swarm[] swarms; int swarmCount; void setup() { size(640, 480); smooth(); background(0); frameRate(30); reset(); } void reset() { swarmCount = int(random(1, 3)); swarms = new Swarm[swarmCount]; for (int i = 0; i < swarmCount; i++) { swarms[i] = new Swarm(); } } void mousePressed() { reset(); } void draw() { // Fade out the old noStroke(); fill(0, 40); rect(0, 0, width, height); // Move the swarms for (int i = 0; i < swarmCount; i++) { if (swarms[i].pCount < 1) { swarms[i] = new Swarm(); } swarms[i].move(); } }