Game Jam 1: Super Lario

I started my little adventure in games when my January term for UVa ended and it was two weeks until Spring semester started. I tried out Unity a couple months into quarantine, but decided it wasn’t for me. The amount of options was overwhelming. But I decided then to try out Godot, a free and open-source game engine for 2D and 3D games. It has a lot of simple tools that made my job easier, without being overwhelming.

SUPER LARIO

The first game I tried to make was a sequel to my 2019 pygame final project for CS 1110 Introduction to Programming, Super Lario. Super Lario was a 2D platformer much like the Mario games, with the ability to take in a tileset and create a level with multiple blocks, breaking select blocks by jumping underneath them, parallax backgrounds, both horizontal and vertical acceleration and friction for the main character, and animated sprites. The goal of the game was to collect coins and make it to the end as fast as possible with the most coins.

The full gameplay for Super Lario 1 is here:

SUPER LARIO 2

Full video of the game here:


Play the game in your browser here:


You can see the project yourself on GitHub here:


I wanted to remake Super Lario because it was simple to play and to make, and would be a good project to familiarize myself with this new tool. I started by simply implementing the movement.

MOVEMENT

I used a similar system from Super Lario 1, a system where when the player presses a movement key and is stopped, they start moving with a base velocity, and as they keep the key pressed, their velocity increases by a constant acceleration up until a certain maximum velocity, where the velocity is capped. At the same time, there is a constant friction, that is applied to the velocity vector down until a lower bound of velocity. To prevent sliding at smaller velocities, past that lower bound the velocity is set to zero. Vertical velocity works by multiplying the delta (change in time) by constant gravity and adding it to vertical velocity, as well as a jump feature that adds a jump velocity in the opposite direction. The end result of this movement system is movement that doesn’t feel stiff; Lario has momentum, and he takes a bit to stop after the key is not pressed. The movement, however, does not feel too slide-y, and stops with a degree of accuracy that makes tight jumps possible. The addition of a double jump helps increase the player’s air control as well.

WORLD

Godot has many useful tools, including a tilemap tool that I made use of for building the world. With Lario 1 on pygame, I had a short timeframe so I implemented my own version where I fed the program a two-dimensional list of numbers representing blocks at each y level in the world, and wrote some code to add hitboxes and textures to each distinct block. Godot’s tilemap tool is much easier to use than a list, and simply right and left clicking is enough to build the level. I included decorative tiles such as grass and animals. One place where tilemaps did not work was blocks that would change their state based on player interaction. I had to create another solution if I wanted to implement breakable blocks and coins, unlike my 2D list solution.

INTERACTIVE OBJECTS

For the destructible blocks, I simply took one of the tilemap textures and made it an object the same size as a single tile. There is collision on the top and an area on the bottom. If another object enters that area, and that object is the player, the block will play a sound and free itself from the scene, allowing the player through. One problem I had here was that freeing the object would cut off the sound, so I had to add a timer to play the sound and only then free the object to let the player pass.

Coins and hearts were simpler to add. If the player enters their pickup area, the player get an additional heart/coin to the total.

NEW ADDITIONS

I didn’t stop at simply remaking Super Lario 1. Instead, I decided to add features that I wanted to add to the first game but could not due to time constraints. One of the things I had wanted to add the most were enemies. These new enemies in Super Lario 2 would walk until they hit a block then turn around and walk the other way, in a cycle. The player can jump on their heads to kill them. The enemies were very easy to add, but one of the things I had more trouble with was getting the player stuck between an enemy and a wall and losing all their hearts within moments. So I added a 1.5 second invulnerability after being hit, indicated by the character going transparent for that time.

The new level was also much more advanced. I even included a light puzzle at the end involving breaking blocks and waiting for the chance to jump on the enemy’s head. The tilemap system allowed greater freedom to change the layout at will.

CONCLUSION

In conclusion, I was able to become familiar with the Godot engine in a matter of days. The engine supports C# and GDscript for scripting, but I chose GDscript due to its similarities to Python. The tool is very powerful but also very easy to learn. I was able to export my game to HTML5 and upload it to itch.io in less than a minute, but Godot also supports exporting to virtually every other platform.

Next game: Thumb War