Mouse detected in a rectangle
in
Programming Questions
•
8 months ago
I am trying to detect the mouse when in this rectangle, whoever I think I am doing something wrong. This is the part of my code that I am not doing correctly. Could you please help me out?
float w;
float h;
int wall;
void setup() {
size(700,700);
w = 0;
h = 0;
wall = 15;
}
void draw() {
rect(w,h,w+wall,h+height);
if (mouseX <= wall) {
ellipse(100, 100, 100, 100);
}
}
1