ICM / Week 5 / Arrays and objects

In honor of October 9th’s Second Presidential Debate of 2016 between Hillary Clinton and Donald Trump, click the mouse to make Hillary appear and keep Trump at his wall.

Eventually, I’d like to keep adding on to this sketch by making the bricks fall when Trump’s head bounces on it like the Atari game, Breakout. My attempt to make the individual bricks with arrays wasn’t quite successful, so for now, the blocks in this sketch are drawn with a for loop (with the ‘work-in-progress’ commands to make arrays of the individual blocks commented out in the code). I also want to toggle between using Hillary as the bouncy ball with a key press of “H” for all the Hillary supporters and a key press of “T” for Trump supporters. Another thing that I came across that was a little complicated was drawing stars. Drawing stars from scratch requires lots of math, but in following one of the virtues of a lazy programmer, I was able to copy the star-making code from the p5.js reference library. I also kept the code from the synthesis in the sketch, so Hillary can turn into a potentiometer paddle to bounce Trump’s head on when connected to a sensor.

Photos of Clinton and Trump’s bouncy heads were taken from The New York TimesPresidential Polls Forecast

Posted in ICM

Leave a Reply

Your email address will not be published. Required fields are marked *