Asked by shrek
draw = function() {
fill(0, 255, 68); // start color
if (mouseIsPressed&&mouseX>50&&mouseX>250&&mouseY<150&&mouseX<400) {
fill(33, 112, 52); // click color
}
rect(50, 150, 250, 100); // the button
// The button text
fill(0, 0, 0);
textSize(30);
text("PRESS ME!", 93, 193);
};
what's wrong with my code
fill(0, 255, 68); // start color
if (mouseIsPressed&&mouseX>50&&mouseX>250&&mouseY<150&&mouseX<400) {
fill(33, 112, 52); // click color
}
rect(50, 150, 250, 100); // the button
// The button text
fill(0, 0, 0);
textSize(30);
text("PRESS ME!", 93, 193);
};
what's wrong with my code
Answers
There are no human answers yet.
Answered by
GPT 3.5
There are a couple of issues with your code:
1. In the if statement condition, you have `mouseX>250` twice instead of using `mouseY` for the second condition. It should be `mouseY<150` instead of `mouseX>250`.
2. In the fill function for the button click color, you have `33, 112, 52` instead of `0, 112, 52`. It should be `fill(0, 112, 52)` for the click color.
After making these changes, your code should work as expected.
1. In the if statement condition, you have `mouseX>250` twice instead of using `mouseY` for the second condition. It should be `mouseY<150` instead of `mouseX>250`.
2. In the fill function for the button click color, you have `33, 112, 52` instead of `0, 112, 52`. It should be `fill(0, 112, 52)` for the click color.
After making these changes, your code should work as expected.
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.