
Soooooo… in the spirit of Halloween, I made the famous catching game with a little bit touch of spookiness!
The game is inspired by “Touch the cube” by “batmangreen123” from the following website:
About the game!
The logistics of the game is pretty straight forward. The player controls the catcher, which is a ghost in my edition, by moving the mouse to catch candies randomly dropping from the top of the screen. If the candy is caught, the player scores 1, and another candy will drop at a faster speed; otherwise, the player loses the game, and the ending screen shows the overall score the player earned.
Creating the game!
In order to make the game stand out from other basic catching games, I uploaded the Halloween images to the p5js file and preload to the sketch.

Then, create the canvas and draw the 3 types of screens. Add text to the screens for game instructions.

By creating variables for the ghpst, candies and the score, I then designed the logics of candy dropping, score adding, and losing the game.

To play the game or to view the original codes, use the link below:
Obstacles I encountered…
I forgot to reset the values of scores and positions of game elements at first, so when a new game is created, the score value and the speed of candies were still from the last round. So I added the reset() function at the end so that whenever a new game is created, everything starts from scratches.

So that’s about my week 4 assignment, happy Halloween!
References: