We are about to switch to a new forum software. Until then we have removed the registration on this forum.
int x = 50; int y = 50; int w = 150; int h = 150; int rectSize = 50;
void setup() { size(600,600);
}
void draw() {
background(255,255,255); stroke(255);
if( mouseX>x && mouseX<x+w && mouseY>y && mouseY<y+h ) {
fill(0,0,255);
} else {
fill(127);
}
rect(x,y,rectSize,rectSize); rect(x,w,rectSize,rectSize);
}
-can someone make a simple code that can turn the other rectangle fill to any color other than blue when touch by mouse. Thank you for help:)
Answers
Read the tutorial on collision detection, specifically point / rectangle:
http://www.jeffreythompson.org/collision-detection/point-rect.php
https://forum.processing.org/two/discussion/21148/do-not-delete-your-posts