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