// Use a single Boid Boid b; void setup() { // Setup our environment size(600, 400); colorMode(RGB, 255, 255, 255, 100); smooth(); // We'll start our boid in the center of the screen. The parameters // for our boid: // // Vector3D => Starting location // 5.0f => Maximum Boid Speed // 0.1f => Maximum Accerlerating Force b = new Boid(new Vector3D(width / 2, height / 2, 0), 5.0f, 0.1f); } void draw() { // clear the background background(0); // draw an ellipse around our mouse fill(150); noStroke(); ellipse(mouseX, mouseY, 30, 30); // let our boid seek the mouse b.seek(new Vector3D(mouseX, mouseY, 0)); // run the boid simulation b.simulate(); }