ball[] swarm; int swarmSize; void setup(){ size(500,500); swarmSize = 10; // Define the size of the swarm swarm = new ball[swarmSize]; for(int i = 0; i < swarmSize; i = i + 1){ swarm[i] = new ball(); // Create the swarm } } void draw(){ fill(200,200,200,100); // slight transparency rect(0,0,width,height); for(int i = 0; i < swarmSize; i = i + 1){ swarm[i].display(); // Display each ball swarm[i].update(); // Move each ball } }