top of page
  • Writer's pictureIbrahim Hashmat

ICM Entry #6: Object-oriented code

For this week's work I decided to create a 'Donut Factory' using object-oriented code with an array, a class that has some functions within it and some functions that operate outside the class.



I had lads of fun making this code, probably the most I've had so far this semester. My initial idea for a sketch was to make a shaving mini-game where the user would use their mouse to shave off hair from hairy stick figure. Unfortunately, that proved way too complicated to do because I was having trouble using the "splice" to remove different elements from the stick figure array.


After feeling defeated I decided to watch some Simpsons videos to shake off the loss. I across Homer eating a donut. I don't know if I was hungry while watching this or what but this became my goal, to create a pink frosted donut.

During my practice sessions I had trouble making a good looking donut, so I decided to use 'Hapless Veil' by Thunderstealth as a template for my donuts. I took their code for the shape of the donuts and implemented it into my sketch.



I made a 'food' array that uses 'Donut' as a class.



This is the Donut class I created with different functions within it. I experimented with rollover to change the color of the donuts, to mimic how their color changes when you bake them in an oven. I used 'clicked' to add communication to the sketch. If you click on any donut, the console says 'Your donut is ready!'. So you can enjoy your pink frosted donut just like Homer does.





This is how the sketch looks like when it runs. I use 'mouseWheel' to make the donuts appear, I then I rollover and their color changes from purple to pink, showing that they're being cooked. Finally clicking on them prints out 'Your Donut is ready!' in the console.




4 views0 comments

Recent Posts

See All

ICM Media Entry#5 Markov Chains and Text

The prompt for this week felt very open ended (more so than usual) and I felt like I should try something completely different to what we did in class, so I picked Markov chains. For my assignment thi

Post: Blog2_Post
bottom of page