How to make the other rectangle to fill any color other than blue when touch by mouse

edited September 2017 in Questions about Code

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:)

This discussion has been closed.