Rewriting Super Mario Bros. from NES to GML the Easy Way

gamemaker official
gamemaker official

The world of Super Mario Bros. is one that has captivated millions of gamers since its inception in 1985. It’s a world filled with mushroom kingdoms, fire-breathing turtles, and a heroic plumber on a quest to save a princess. But have you ever wondered how this world could be recreated using GameMaker Language (GML)? Let’s take a journey through the development of Super Mario Bros. and see how we could use GML to bring this iconic game to life.

The creation of Super Mario Bros. was a revolutionary moment in the gaming industry. Shigeru Miyamoto, the creator of Mario, wanted to recreate the child-like experience of exploring a strange world filled with mystery and adventure. He wanted players to ask questions like, “Why is there a manhole on the wall? Where does it lead?” This sense of exploration and curiosity was one of the key factors that contributed to the game’s wild success.

In GML, we can recreate this sense of exploration by using objects and rooms. Objects in GML are entities that have properties and behaviors. They can be anything from the player’s character to the enemies, power-ups, and even the terrain. Rooms, on the other hand, are where these objects exist and interact. They are the stages or levels in the game.

Let’s start with the character, Mario. In Super Mario Bros., Mario’s main actions are running and jumping. We can create an object in GML for Mario and define his behaviors using events and actions. For example, we can use the “Step” event to control Mario’s movement and the “Key Press” event to make him jump. Here’s a simple example of how this could look in GML:

// Create event
speed = 4;
jump_speed = 8;

// Step event
if (keyboard_check(vk_right)) {
    x += speed;
} else if (keyboard_check(vk_left)) {
    x -= speed;

if (keyboard_check_pressed(vk_space)) {
    y -= jump_speed;

In this code, we’re setting Mario’s speed and jump speed in the “Create” event. In the “Step” event, we’re checking if the right or left arrow keys are being pressed and moving Mario accordingly. If the space bar is pressed, Mario jumps.

Next, let’s talk about the terrain. In Super Mario Bros., the terrain is filled with platforms, pipes, and obstacles. We can create these as objects in GML and define their behaviors. For example, we can create a “Solid” object that stops Mario from moving through it. Here’s an example:

// Create event for Solid object
solid = true;

In this code, we’re simply setting a variable “solid” to true in the “Create” event of the Solid object. We can then use this variable in Mario’s code to check for collisions and stop him from moving through solid objects.

Now, let’s talk about the enemies. In Super Mario Bros., there are various enemies like Goombas and Koopas that Mario must avoid or defeat. We can create these as objects in GML and define their behaviors. For example, we can create a “Goomba” object that moves back and forth and hurts Mario if he touches it. Here’s an example:

// Create event for Goomba object
speed = 2;
direction = 180;

// Step event
x += lengthdir_x(speed, direction);

// Collision event with Mario
if (instance_exists(obj_Mario)) {
    with (obj_Mario) {
        // Code to hurt Mario

In this code, we’re setting the Goomba’s speed and direction in the “Create” event. In the “Step” event, we’re moving the Goomba in its set direction. In the “Collision” event with Mario, we’re hurting Mario.

These are just basic examples of how Super Mario Bros. could be recreated in GML. There are many more aspects to consider, such as power-ups, level design, and game progression. However, with GML’s flexibility and power, the possibilities are endless. So, why not take a leap of faith, just like our beloved plumber, and dive into the world of game development with GML? Who knows, you might just create the next gaming sensation.

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

GIPHY App Key not set. Please check settings

Object-Oriented Programming in GameMaker Language and How to Use It

gamemaker official

The battle between Mobile vs HTML5 and How to choose the Right One