Consume The Earth
16 Oct 2019 - Jake Sherwood
Plant a tree or Consume the Earth
Icm - Midterm - Consume The Earth - Arrays And Objects
Our midterm assignment was to use arrays and objects and create classes with at least one function in them.
My project was my first attempt at a somewhat conceptual game idea to raise awareness on climate change.
I had the idea of having an earth where a user or two could either choose to plant a tree or consume the earth.
Planting trees would save the earth and consuming would kill the earth.
As you plant trees (left arrow keypress) it creates tree objects from the Trees class and add them to the tress array. The Tree objects are comprised of varying triangles and rects that wrap around the earth.
As you consume it (right arrow keypress) it creates consume objects fromt the Consume class and adds them to the consume array. The Consume objects are p5.image objects pulled from an array of image names. You either consume a Starbucks, McDonalds fries, iPhone, or TV.
There are if statements comparing the size of the arrays and if earth lives, I clear the consume array and draw Trees around the whole earth. If the earth dies a animated gif of flames is added over top of the earth.
I also drew out the earth with p5 which was a total PITA… don’t recommend it… should have just used and image. Oh hindsight…
Final p5.js sketch link: https://editor.p5js.org/lucidprojects/sketches/Cvhy1js_S