Sunday 24 March 2013

More Pac-man


I have added a cherry to the game. It appears randomly and gives the player 300 points. In the code above, when the beginning song ends, It sets a variable called cherry to a number between 1-15, waits 5 seconds, then repeats. The code to the left hides the cherry and says that if the variable cherry is equal to 5, the cherry must appear. This means every 5 seconds there is a 1 in 15 chance of the cherry appearing. It just repeats this code checking every time.

This code gives Pac-man his score. It checks if is touching egg (the secret Easter egg :D) and then checks if Pac-man's yellow is touching the cherry red. If  it is, the variable score gets 300 more points. I still have to make it so that the cherry hides itself so that there isn't endless points to be taken.
I also moved some ghost movement points to prevent glitches.


No comments:

Post a Comment