Midterm Assignment

“Shoot the Balloons”


My game is a classic carnival game, where the player has to shoot as many balloons as they can in a given time. I put the time as 45 seconds but realized it was low and changed to 120 seconds.

I created a balloon class for the balloons. Initialized an array and added 4×6 balloons (for loop) in it. Then used the run function to display them at their positions. For the shooting part, I had a distance variable that calculated the distance from the click to the position of the balloon, and if it’s in a certain range the balloon pops. For popping, I simply pop the balloon object from the array. I added burst sound effect when it pops and shoots effect when the mouse is pressed anywhere else. Also, added a timer and score display. In the end, there’s a game over screen with a score and instructions to restart.

There were two main challenges. I wanted to have random colors of balloons. I was using a sprite sheet with 6 colors of balloons. However, shooting a balloon displayed, made the whole screen disappear. That was because when I was adding balloons in my array, it was basically the whole sheet and not one balloon and popping that means removing the whole screen? So, I changed my image with only one balloon.
Another challenge was restarting the game or having multiple screens. My code was in a certain fashion that it was difficult to implement the screens one after the other- it led to crashing/overlapping of screens. The restarting the game was difficult as well-later I figured out that simply used keypressed() to restart.

Overall, it was a fun game to implement, and learned several techniques of typical games. While some things were challenging as mentioned above, I am glad I am done with it! yay

Leave a Reply