Press the mouse to change the color of the squares and release to change them back
xxxxxxxxxx
/*------------------------
Mouse Pressed
Pressing the mouse to change color
Created 1/31/17
Kali Johnston
SP 2017
knjohnston0704@gmail.com
https://www.openprocessing.org/sketch/403039
---------------------------*/
int value =0;
void setup () {
size (500,500);
background(150,0,0);
}
void draw () {
background (150,0,0);
rectMode(CENTER);
fill(value);
rect(100,100,100,100);
rect(200,200,100,100);
}
void mousePressed() {
if (value == 0){
} else {
value = 0;
}
}
void mouseReleased() {
if (value == 0) {
value = 255;
} else {
value = 0;
}
}