CONCEPT:
For my midterm project, I decided to combine my two favorite things together, SpongeBob and my childhood game Geometry Dash (which was my first inspiration for the game).
I decided to be more creative and create my own version of geometry dash using Spongebob as my main theme. Furthermore, instead of jumping over obstacles, you have to jump over SpongeBob characters.
The main goal of the game is to score as many points as possible by avoiding colliding with an obstacle; it’s pretty simple. I also added a twist to it; there’s a feature where you can fuel up the power bar by gaining more points, which leads to a rocket mode effect where you can collect double points but instead of jumping, you’re flying. For the characters, I decided just to use png images online, which I will attach to the website at the bottom; however, to incorporate shapes and colour, I decided to use shapes and gradients to create the theme of the background, including the burgers and jellyfish. I also used a Spongebob font for the text to add more to the aesthetic. To organize my codes, because at some point it got messy, I decided to create multiple files, for functions and classes, which made it a lot easier as I knew where everything was and it was most helpful in debugging anything if there was an error.
HIGHLIGHT:
The code I’m most proud of is probably the jellyfish part of the game because it handles more than one thing like spawning, moving, and removing jellyfish, while also checking for player collisions. It also has conditional behavior since the jellyfish can only cause the game to end when the player is in rocket mode. I had to redo the code multiple times as there were a lot of errors in the beginning and I had to update multiple loops. Additionally, it depends on variables like `isRocketMode` and `gameOver` from other parts of the game, which makes it more complicated to manage since it must stay in sync with the overall game.
here is the code:
function updateJellyfishObstacles() {
// Spawn new jellyfish obstacles at intervals
if (frameCount % jellyfishInterval === 0 && jellyfishObstacles.length < maxJellyfish) {
let jellyfishY = random(70, height - 80);
let jellyfish = new Jellyfish();
jellyfish.y = jellyfishY;
jellyfishObstacles.push(jellyfish);
}
// Update jellyfish obstacles and handle rocket mode collisions
for (let i = jellyfishObstacles.length - 1; i >= 0; i--) {
jellyfishObstacles[i].move();
jellyfishObstacles[i].show();
// Remove off-screen jellyfish
if (jellyfishObstacles[i].offScreen()) {
jellyfishObstacles.splice(i, 1);
continue; // Move to the next jellyfish
}
// Only trigger game over if the player hits a jellyfish while in rocket mode
if (jellyfishObstacles[i].hits(player)) {
if (isRocketMode) {
deathSound.play();
gameOver = true;
}
}
}
}
IMPROVEMENTS:
In the future, I would probably like to add more elements to the game as it gets repetitive. Also, if I had more time I would fix this upside-down section of the game, as I feel like it looks odd in some sort of way, since the obstacles are upside down but not the player. Moreover, I would also improve the way the obstacles are shown in the game, as I fear they aren’t visually clear or hurt the eyes when you look at it too long, and it is because its moving fast, however, if its too slow, the game would be easier.
Here is the game:
REFRENCES:
https://www.jsdelivr.com/package/gh/bmoren/p5.collide2D. (my collide reaction HTML)
https://www.fontspace.com/category/spongebob (font)
https://www.pngegg.com/en/search?q=spongebob (all my images)