float x=0; void setup() { size(500,400); } void draw() { x = (x+4) % width; background(0); if (mousePressed) { fill(255,0,0); // red ellipse(x, mouseY, 20, 20); } else { fill(255); // white ellipse(x, height/2, 20, 20); } }