Homework 4

When we arrived at the museum of math, I was surprised of not actually seeing any antiques, biographies and statues of mathematicians or any old machines that mathematicians have used in the past (like primitive calculators). Instead, the museum was pretty modern and only had one old cipher machine that was loaned from another museum.

The exhibitions in the museum were very cool and interesting especially the tricycle with square wheels. I think the design of this exhibitions was very interesting to know more about. I think it would be very interesting for me to know more about the math and physics that explain the behavior of the tricycle when it is moving without deviation from its pre-determined path.

(The assignment)

Once more, for this assignment I have created a game. This game is quite different from the previous two. The main logic of the game is to pick  up 10 healthy eggs falling from random position from the top of the screen and avoiding the rotten eggs. If the user picks up 3 rotten eggs, he/she loses the game.

The main goals I have set before creating the game  were as follow:

  1. Use arrays and objects
  2. Make a better quality design of this game and how it looked like
  3. To make the game more fun to play and in somehow more lively

The first goal was not an issue and I used a pretty similar method to the method professor shiffman used in class on Friday to demonstrate the use of the arrays and the push function in the bouncer program.

The second goal was accomplished by adding a background photo, a photo for the egg picker and finally photos of healthy and rotten eggs. I have used the loadImage() function to load the images to p5 and the image() function to actually display the image at a specific position on the screen.

For the third goal, I incorporated sound effects in the game. When the user picks up a rotten egg, a buzzer like sound will beep to indicate a wrong pick and another sound to indicate a good pick. I have used the loadSound() function to load the sound effects to the program and the play() function to play the sound when an egg is picked.

The main issue I had with creating this game was actually adding the sound effects because p5 did not seem to recognize the loadSound() function for some reason and I had to search online for the same until I found it that I had to uncomment some specific line of code in the library file. After, I have done this, the code ran properly.

Another issue I ran in to was to actually upload the game to the web editor. The web editor was not able to locate the images and sound files I have uploaded to the code so I had to seek help from professor shiffman who shared with me a link showing the steps of how to upload the game to my directory in the web so that the code could run properly. You can check out the game using this URL:

rha257.nyuad.im

It was another fun task to carry out and I learned new stuff about p5 like the sound functions. In general, the game was fine to create and hopefully I will creating more games for the next tasks.

 

Leave a Reply

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