// My moving Squares // Marcella Todaro // http://www.openprocessing.org/sketch/49183 SquaresArray [] button = new SquaresArray [300]; void setup () { size (500, 500); smooth (); //Array of Squares for (int i=0; iwidth-squareSize)) { xspeed = -xspeed; } if ( (y<0) || (y>height-squareSize)) { yspeed = -yspeed; } } void drawSquaresArray () { if (clicked) { fill (133, 133, 221); //Fill square light blue } else { fill (255, 255, 0); // Fill square yellow } rect (x, y, squareSize, squareSize); } void checkMousePress () { if ((mouseX > x) && (mouseX< x + squareSize) && (mouseY > y) && (mouseY< y + squareSize)) { clicked = !clicked; } } }