Learn creative coding writing simple programs

97. Interacting with many rectangles (I)

This time we create five arrays to store information about a collection of rectangles. The five arrays are used to store the color and the left, top, right and bottom borders of each rectangle.
By storing this information in arrays we can draw those rectangles as many times as we want, and also calculate if the mouse is inside or outside of each rectangle.
No new concepts are introduced this time. Episode 98 continues where this one ends.

Tags: interactive, rectangle, mouse, over, array, collection

Code editor

You can make changes to the code below. Then

Questions and comments

Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)

To indicate that a word in your comment is code, use the `backtick`. Example
  Do `float` and `int` smell similar?
To highlight code blocks, use ```processing and ``` like this:
  void setup() {
    size(600, 600);