how can I make it, that I hit the mouseButton once, and the square is moving till x=100? It's only working when I'm holing mouse1 pressed. I want it, that ur pressing mouse1 and the square is moving till x= 100.
int rectX = 0;
void setup () {
size (200, 200);
}
void draw () {
background (100);
stroke (255);
fill (180);
rect (rectX, 100, 20, 20);
if (mousePressed && rectX < 100)
rectX += 1;
}
void mousePressed () {
}
thanks