xxxxxxxxxx
/**
Katie Frank
Art 3001
Float-over squares
January 31, 2017
**/
//coordinates
int x = 200;
int y = 200;
int x2 = 400;
int y2 = 200;
//button size
int w = 200;
int h = 200;
void setup() {
size(800, 500);
background (204);
fill (0);
rect(200, 200, 200, 200);
rect(400, 200, 200, 200);
}
void draw() {
if ((mouseX > x) && (mouseX <x+w) && (mouseY > y) && mouseY < y+h) {
fill(255);
rect(200, 200, 200, 200);
}
else if ((mouseX > x2) && (mouseX < x2+w) && (mouseY > y2) && mouseY < y2+h) {
fill(255);
rect(400, 200, 200, 200);
} else {
fill (0);
rect(200, 200, 200, 200);
rect(400, 200, 200, 200);
}
}