How can i delete rects with the mouseMoved() command?
in
Programming Questions
•
5 months ago
Hey guys! and sorry for my bad english :(
So, first of all, here is my code:
(I'm a beginner)
float[][] coords = new float[10][2];
void setup(){
size(640, 480);
fill(0);
for(int i=0; i<10; i++){
coords[i][0] = random(630);
coords[i][1] = random(470);
}
}
void draw(){
background(10, 130, 210);
for(int i=0; i<10; i++){
rect(coords[i][0], coords[i][1], 10, 10);
}
}
What i want is if the mouse just touch the random created rect processing should delete it. Ist this possible? And the rects shouldn't respawn again. If i collected, or touched, all the rects maybe the programm can write a message like "Nice, you collected all the rects!"
Do commands exist for this? And please, don't be to severe with me, i'm a beginner (:
So, first of all, here is my code:
(I'm a beginner)
float[][] coords = new float[10][2];
void setup(){
size(640, 480);
fill(0);
for(int i=0; i<10; i++){
coords[i][0] = random(630);
coords[i][1] = random(470);
}
}
void draw(){
background(10, 130, 210);
for(int i=0; i<10; i++){
rect(coords[i][0], coords[i][1], 10, 10);
}
}
What i want is if the mouse just touch the random created rect processing should delete it. Ist this possible? And the rects shouldn't respawn again. If i collected, or touched, all the rects maybe the programm can write a message like "Nice, you collected all the rects!"
Do commands exist for this? And please, don't be to severe with me, i'm a beginner (:
1