Game theme and Concept
- Genre – First Person Shooter (FPS) game
- The main goal of the game – get a higher score by shooting as much as golems as possible using the limited amount of bullets provided
Implementation
- Structure of the overall program
- Setup()
- set variables to avoid unexpected bugs
- set frameRate to 60 to make sure all computers display the same result
- Divide the PNG file into frames of each sprite (Gun, Golems)
- Create a pool of Golems that respawn when killed
- mousePressed()
- Pause Button
- Resume Button
- Click to Shoot – Only when you have enough Ammo
- Start Button
- draw()
- make objects move according to the movement of the mouse cursor
- display Golems
- Display Cross in the middle of the screen
- Display PauseUI / StartUI when the game is paused/starts
- GunClass
- display() – display the sprite images by frames
- move() – Shooting motion when the mouse is clicked
- Golem
- display() – display the sprite image by frames
- alive() – the movement of golem when it is moving across the screen
- deadMotion() – movement of golem when it is shot
- respawn() – waits for a few frames and resets itself in a random position
- Setup()
- Techniques Used
- Instead of adding an extra golem whenever a golem is killed, I decided to reset the golem that is killed so that there is less use of data and reduce the amount of trash data by recycling resources. – Advantage of OOP.
- By transposing the golems the same amount as the movement of the background image, the game gives a strong conception of being in the middle of the scene, looking at the screen from the first-person’s point of view.
Here below is my final version of the midterm project game! Enjoy!
(Recommended to Play in Fullscreen Version)
https://editor.p5js.org/yl4643/full/Rr46vntt5