I have a test tomorrow and I don’t know what is wrong with my code. I am supposed to make one ellipse and a rectangle with a circle following the mouse. The circle is on top of the ellipse but behind the rectangle. How do you make it so that when the mouse is over the rectangle, the rectangle changes color to brown and the background changes to green. I tried the code below but when I place my mouse on the rectangle, only the background changes color, and not the rectangle. Am I doing something wrong? Please help!!!
void setup() {
size(600,600);
background(26,204,243);
}
void draw() {
background(26,204,243);
if ((mouseX >= 200 && mouseX <= 400) && (mouseY >= 100 && mouseY <= 500)) {
fill(200,200,200);
ellipse(300,100,500,200);
fill(215,23,23);
ellipse(mouseX,mouseY,20,20);
fill(10,35,222);
rect(200,100,200,400);
} else
background(53,148,30);
fill(200,200,200);
ellipse(300,100,500,200);
fill(215,23,23);
ellipse(mouseX,mouseY,20,20);
fill(50,50,50);
rect(200,100,200,400);
}