Midterm Project: Scuba Diving

For the midterm project, I decided on making a scuba diving game where the player will be encounter sea treasures and sea monsters in a continuous stream. The player will accumulate points by colliding with sea treasures but when a collision is made with a sea monster, the player’s initial life points of 3 is reduced by 1. After the life points reach zero, the game will end and the player will have to start again.

This idea was inspired by a game a made with the python kivy module. In that version, the player moves a track and accumulates points by staying on the underwater track for as long as possible. A screenshot is included below:

The game will look something like this:

Female scuba diver swimming under water Stock Photo

I downloaded scuba diver sprites and extracted the various stances. I set up a background image for the game and created movements with the mouse and keyboard.

You can click at the on any position to make the sprite move or you can move by pressing the arrow keys on the keyboard. The code is below:

function keyPressed() {
if (keyCode === DOWN_ARROW) {
posy += speed;
}if (keyCode === LEFT_ARROW) {
posx -= speed;
}if (keyCode === RIGHT_ARROW) {
posx += speed;
}if (keyCode === UP_ARROW) {
posy -= speed;

function mousePressed(){
posx = mouseX;
posy = mouseY;

The sketch is embedded below:



  • Change the sprites based on the different movements
  • Make the transition between sprites smooth
  • Add monster and treasure sprites
  • Let the monster and treasure sprites flow continuously from right to left randomly and with different speeds
  • Add sound when collisions are with treasure and monsters
  • Display an interface for starting and ending the game

Leave a Reply