Week 12 & 13 - Algorithms
Week 12 & 13 - Algorithms
For this project, I wanted to create a slot machine game using the ice cream cone imagery that I have been using throughout the course. To start off, I took screenshots of the sketches in order to make individual PNGs of the ice cream cones to later add to an array. I then used Photoshop to remove the background so I was left with just the shapes. I found an example of a simple slot machine game that I used as a starting off point, and made changes and additions to the code to suit my needs. The first thing I changed was the code had a lot of redundancy, so I removed and simplified that, as well as making the naming conventions more intuitive. I edited the design of the original components to suit my personal style as well. Originally, the images of the reels stopped one at a time, which I didn't like because in many cases, you would know you have already lost the game before it was even over, so I changed it so the images would all stop at the same time. I also decreased the time the reels animated and the bottom text would appear because it just felt too long initially. I also changed the way the images would animate while the reels were spinning so it would look like the ice cream cones were "flashing" rather than "spinning". In addition to this, I also wanted to incorporate a type of "reward" for when the user wins the game, so I added a confetti element that will play for 3 seconds and then clear so the user can keep playing if they wish. I utilized ChatGPT for this component, and added the same ice cream cone PNGs so it looks like many tiny ice cream cones are raining down rather than regular confetti shapes. The challenges I had were making sure each component worked individually, then finding the correct way to assemble them into one piece of code. The further along I got in the project, it got confusing where each element fit, and to make sure I didn't have redundant code and to make sure each element didn't conflict with the others. The solution to this was to just focus on one element at a time and to stay organized by grouping related things together in a consistent way and to make sure to label everything.