Hey guys. I'm trying to get this minigame setup. The game works where a bunch of moving green squares are moving around on the screen. When you click on one it turns red and stops moving. When a green moving square touches a red one, the red one turns green and moves around again. I just need the last part where when a square that is red gets hit by a green one, it turns green and moves. Here is my Code:
//Tab 1
Movingrect [] theArray;
int numrect = 20;
void setup ()
{
size (600,600);
theArray = new Movingrect [numrect];
for ( int i=0; i<numrect; i++)
{
theArray[i] = new Movingrect (300, 300);
}
}
void draw ()
{
background (200);
for ( int i = 0; i < numrect; i++)
{
theArray[i].drawrect();
theArray[i].updateLocation();
}
}
void mouseClicked ()
{
for (int i=0; i<numrect; i++)
{
if ((mouseX >= theArray[i].getX()) && (mouseX <= theArray[i].getX()+50) &&