ArrayList boids; int numBoids = 50; void setup() { size(400, 400); stroke(0); smooth(); boids = new ArrayList(); for (int i = 0; i < numBoids; i++) { PVector initialPosition = new PVector((width/2) + random(-400, 400), (height/2) + random(-400, 400)); PVector initialVelocity = new PVector(0, 0); boids.add(new Boid(initialPosition, initialVelocity)); } } void draw() { background(0); for (int i = 0; i < boids.size(); i++) { Boid boid = (Boid) boids.get(i); boid.drawFlock(); boid.behaviours(boids); } }