Arranging an array of objects in a grid

@Chrisir Yes!!! That works! :grinning: :grinning:

And one last question for today…

Since the background color bounces back and forth between 2 random colors, I want to have a completely different random color each time. I added a randomly generated number to the mouseClicked statement (then placed at head of program too as a global variable) but get the same results – only 2 alternating colors.

Again, your thoughts most appreciated!

mouseClicked() now looks like this:

void mouseClicked() { 
  
  //int n = int(random(10, 200));
  
  // I want to change background color when I click mouse...
  if ( background == color( r1, g1, b1) ) {  //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    background = color(r2/n, g2/n, b2/n);
  } else {
    background = color(r1, g1, b1);
  }
}
1 Like