Week 8 - Functions
Week 8 - Functions
For this project I created a function that creates multiple ice cream cones when the mouse is clicked. You can also clear the screen with a key press and begin again (see demo video below). I think I might use this code in a larger game where you need to "feed" cute animals at a birthday party or something similar to this idea. To make the ice cream cone, I started with elements of the ice cream cone image I made for Week 2 and used them to create a PShape. I didn't incorporate all the details that were in the original image because I didn't think that was necessary for the purposes of this project, but I will probably add them in the future for aesthetic reasons. One of the challenges for this project was to have the ice cream cone follow the mouse instead of just printing once in the top corner of the screen. To fix this, I added a translate function before the shape function (line 84 in the code). Another challenge was the ice cream cone was not centered on the cursor at first. To fix this, I had to adjust the coordinates of the PShape elements so they started in the top left corner (on or near (0,0)). I do want to note that due to the interactivity of this program I did not include parameters to the function. To see my understanding of this concept you can refer to my Week 6 project.