Mover[] movers = new Mover[20]; void setup() { size(300,300); smooth(); background(253); fill(0,0,0); ellipse(150,150,300,300); for (int i = 0; i < movers.length; i++) { movers[i] = new Mover(); } } void draw() { noStroke(); fill(33,10); rect(0,0,width,height); for (int i = 0; i < movers.length; i++) { movers[i].update(); movers[i].checkEdges(); movers[i].display(); } } class Mover { PVector location; PVector velocity; PVector acceleration; float topspeed; Mover() { location = new PVector(random(width),random(height)); velocity = new PVector(0,0); topspeed = 4; } void update() { PVector mouse = new PVector(mouseX,mouseY); PVector dir = PVector.sub(mouse,location); dir.normalize(); dir.mult(0.5); acceleration = dir; velocity.add(acceleration); velocity.limit(topspeed); location.add(velocity); } void display() { stroke(0); fill(120,165,25); ellipse(location.x,location.y,32,16); ellipse(location.x,location.y,60,60); fill(230,0,0); ellipse(location.x+20,location.y,16,32); ellipse(location.x-20,location.y,16,32); fill(3,3,3); ellipse(location.x+19,location.y,11,24); ellipse(location.x-19,location.y,11,24); } void checkEdges() { if (location.x > width) { location.x = 10; } else if (location.x < 0) { location.x = width; } if (location.y > height) { location.y = 10; } else if (location.y < 0) { location.y = height; } } void setup() { size(200,200); smooth(); } }