Class and Array

code: https://editor.p5js.org/ml6458@nyu.edu/sketches/rJyzex257

collaborated with Anna Oh

concept

Anna and I wanted to make an upgraded version of the animal DJ set we made last time. We came up with this cat and dog star wars idea. This is my initial sketch of a rough idea.

process

First, I created a class called animal that contains two arrays, cats and dogs. This is the first prototype we made. Each has five cats and dogs travel diagonally across the screen.

download (1).png

I learned about nested loops when I was doing dog and cat intersecting. Because each cat in the array needs to check each dog in the other array, they need two for loops to check this.