ICM: Week 5 – Objects and Arrays



Cloud City 




Arrays and objects allow you to do something new with your programs: keep track of user action over the course of your sketch’s execution. For this week’s assignment, create a sketch that takes advantage of your new skills. The sketch should allow the user to use clicks, key presses, etc. to add new elements to the scene (and potentially to remove them later). Your sketch should use an array of objects. (Using a constructor function or the class syntax is optional.)

Originally I was inspired by Allison Parrish’s example in the notes on Objects & Arrays




  • Thinking about Arrays within Arrays (or really arrays as objects?)
    • Would like to comb back through code with an *objects & methods* approach:
    • When talking with classmate Jiwon Shin  we started talking about how i could add a deletion tool to my current sketch state (which pushed mouseDrag to an empty array when you drew with mouse down to create each cloud). She walked me through how I could push all of the point drawn with the mousePressed into an array that is then pushed into another array – essentially making cloud objects?


  • One issue I hit when deleting was the program would break if you hit the delete key too many times. When debugging it in the console, we noticed it would try to call a negative number from the array (which doesn’t exist), as a solution – limited the call number to positive numbers only. So no matter how many times you hit “c” the program will still only reference the array number 0, and add on as you draw more clouds.


  • it still breaks if you click without drawing something – it confuses the program, due to no information being pushed to one of the arrays?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s