Guy guy; HashSet treasures = new HashSet(); void setup() { textFont(loadFont("BradleyHandITC-30.vlw")); size(200, 200); // Size should be the first statement noStroke(); // Set line drawing color to white frameRate(30); for (int i=0;i200) {x = 200; xspeed *= .5;} if(y>200) {y = 200; yspeed *= .5;} float MAX = 3; if(sqrt(pow(xspeed,2)+pow(yspeed,2)) > MAX){ float wa = atan2(yspeed,xspeed); xspeed = MAX * cos(wa); yspeed =MAX * sin(wa); } } } Random die=new Random(); ArrayList points=new ArrayList(); class Attractor { public float x; public float y; public float dx; public float dy; public Attractor() { this.x=random(200); this.y=random(200); this.dx=-random(-1,1); this.dy=-random(-1,1); } public void move() { if(mousePressed){ /* if( x < mouseX){ dx += .15; } if( x > mouseX){ dx -= .15; } if( y < mouseY){ dy += .15; } if( y > mouseY){ dy -= .15; } */ } // move with wall bounce this.x+=this.dx; if (this.x<0) { x = 0; dx = abs(dx);} if (this.x>200) { x = 200; dx = -abs(dx);} this.y+=this.dy; if (this.y<0) { y = 0; dy = abs(dy);} if (this.y>200) { y = 200; dy = -abs(dx);} } public float distanceTo(float xx,float yy) { return dist(xx,yy,this.x,this.y); } } float y = 100; int NUMATTRACTORS = 15; void doBackground(){ for (int x=0;x<200;x+=2) { for (int y=0;y<200;y+=2) { int nearest=0; float closest=1000.0; for (int p=0;p