/* mouseX and mouseY are the coordinates of the mouse cursor at any given time. It is alwasy update to date The function mousePressed() is the code that runs whenever the mouse buttons are clicked. */ float x,y; void setup(){ size (640, 480); x = 100; y = 100; } void draw(){ fill(255); rect(0,0,640,480); fill(0,255,255); rect(x,y, 50,50); //This part homes in on the mouse coordinates if(x < mouseX) x = x + 2; else x = x - 2; if(y < mouseY) y = y + 2; else y = y - 2; } void mousePressed(){ print("press yo face!"); }