Started: 07/31/2019
Last Updated: 12/13/2019
Cave Flood is a game in which the player explores a network of caves in search of crystals (which increase the player's score). The caves are very dark, but a small circle of light around the player is illuminated. The cave system is gradually flooding, and the player's light will go out when underwater. The goal is to make it out of the caves in the shortest time possible with the largest score possible. The player's only guide to the confusing cave system is a map which can only be accessed a few times and which fills in as the player explores the caves. The player can choose to either explore the main, pre-designed level or a randomly generated level.
I coded the game in p5.js. The biggest challenges of the project were implemented physics and collision detection for the player's movement and dealing with image manipulation. For the first challenge, I wanted the player's ball avatar to be able to accelerate, collide, and roll through the caves, which are a mix of rectangular and circular shapes. For the second challenge, I wanted the objects in the cave to change color when underwater with a clear "water line" if only partially submerged. As an additional challenge, I wanted some of the crystal images to be rotated, without rotating the water line. I ended up using the image manipulation libraries of p5.js to edit the transparency of each row of pixels as the water level rose, as well as writing my own rotation function to create rotated versions of my crystal images (rather than rotating them as I drew them).
Move with the arrow keys. When in water, use the down arrow key to stop yourself from floating. Find crystals for extra points. While you're submerged in water, your torch is extinguished. Use the map to check where you are. It will fill in as you explore the caves. You have limited uses of the map, so choose wisely when to look at it.
Settings page. Randomly generated map is now an option.
Map limited to three uses. Map bug fixing.
Unlimited use map. (shows a scaled version of the cave system, with only parts the player has been in revealed)
Complete first level design, updated menu
Light effects: When the player is submerged in water, very dark everywhere. When the player is deep in the caves but not submerged in water, very dark everywhere except a small circle around the player. When the player is near the surface, gradient from very dark to no effect, with it getting lighter the closer to the surface the player is. With this update, all of the major features were in place: player physics, cave types, collectable crystals, water, and lighting effects.
Game now recognizes multiple keys being pressed at once (so the player can move left and right while jumping without losing momentum)
Player no longer appears to be submerged in water while above ground.
Switched from processing.js to p5.js for better image manipulation libraries. Player now floats in water.
Added water. The water level gradually rises from not visible to level with the surface, changing the color of the caves and crystals appropriately. Currently no effect on player physics.
Crystals which can be collected to increase the player's score.
Colors changed to represent ground, grass and sky. Ability to leave the cave system to go above ground.
Camera moves to follow the ball when it starts to get out of the screen.
Rectangular passages that can connect multiple shapes together.
Reverse capsules
Capsule (rectangle with a semi-circle on either end) enclosures.
Reverse circles (objects rather than enclosures)
New circular enclosure for ball to interact with.
Multiple ramps (can now be at any angle).
Ball controlled by arrow keys. Interaction with floor and ramp.
Menu with working buttons, instructions page.
Source Code for Cave Flood
The source code is licensed under
Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)