int[] rectX = new int[10];
int[] rectY = new int[10];
color[][] c = new color[10][10];
void setup() {
size(500, 500);
background(200);
noStroke();
for (int x = 0; x < 10; x++) {
for (int y = 0; y <10; y++) {
rectX[x] = x*50 + 25;
rectY[y] = y*50 + 25;
c[x][y] = color(255);
}
}
}
void draw() {
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
fill( c[x][y]);
rectMode(CENTER);
rect(rectX[x], rectY[y], 50, 50);
}
}
}
void mousePressed() {
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
if (25 > dist(rectX[x], rectY[y], mouseX, mouseY)) {
if (c[x][y] == color(255)) {
c[x][y] = color(125);
} else if(c[x][y] == color(125)){
c[x][y] = color(0);
} else if(c[x][y] == color(0)){
c[x][y] = color(255);
}
}
}
}
}