Midterm Project Documentation(Hit the Island Game)

IDEA

For my midterm project, I decided to create a game out of the options from which we could choose any to create a project. A game that would use all the concepts learned in class so far. I got my inspiration from a game on the apple app store called “Hit the Island”. I always wondered how the game was created and how the developers got it to be interactive with the dynamic island on the iPhone 14 pro series. After taking this class, I have gained enough knowledge to know that the game doesn’t actually interact with the dynamic island but has a bar-shaped object behind the island with which the balls in the game interact.

ORIGINAL GAME

The original game below was developed by Funn Media, LLLC.

Code Structure:
The code is structured into several functions that are responsible for different parts of the game. The main functions are as follows:

createPaddles() – This function creates two paddles, one at the top of the canvas and the other at the bottom.

resetGame() – This function resets the game by clearing the balls array and calling createPaddles() to create new paddles.

setup() – This function initializes the game by creating a canvas, calling resetGame(), and loading images and sounds.

preload() – This function loads images and sounds before the game starts.

introScreen() – This function displays the intro screen with the game title.

endScreen() – This function displays the end screen with the player’s score.

gameplay() – This function handles the main gameplay loop by updating the ball’s position, checking for collisions with walls and paddles, and removing balls that fall off the canvas.

checkKeyPressed() – This function checks for keyboard input and moves the paddle left or right, and launches the ball.

Ball class – This class represents the ball in the game and handles its movement, collision detection, and rendering.

Paddle class – This class represents a paddle in the game and handles its movement, collision detection, and rendering.

How the game is played(functionality)
The game starts with the intro screen and waits for the player to press the “s” key to start the game. Once the game starts, the player can move the paddle left or right using the left and right arrow keys.  The ball bounces off the paddles and the walls of the canvas, and the player scores points by hitting the ball with the top paddle. The game ends when the player loses all their lives, and the end screen displays the player’s score. The player can restart the game by pressing the “p” key or return to the intro screen by pressing the “q” key.

GAME

 

CODE SNIPPETS

Main gameplay code

CHALLENGES AND FUTURE IMPROVEMENTS

As at now, the game has a lot of bugs and is still in the “beta testing” phase. There are numerous errors to be fixed including the update of score when the ball hits the top paddle, playing of ball sound when the ball hits the roof of the canvas, and the general collision between the ball and the paddles. In a next update, i intend to fix these errors and also add more levels, varying ball speed and increasing the number of balls when the user gets to a certain score.

 

 

Leave a Reply