Different Endings In The Mario Game:

In Mario, in order to exit the level, most games have you go through a tube.

However, this gets extremely boring, as this happens for each level.

In order to change the ending, there is something that is crucial from your end. Without it, you won’t be able to make much progress, and your ideas will be just as boring as the original ending.

You need to get creative!! Whatever your ideas are, write them down, and create pseudo code (rough draft) on how you can accomplish this. In our team’s level for the Mario Game (level 1), we created a lock and key system. If the player obtained the key, then Mario would be able to exit the level. However, if Mario did not collect the key, they would not be able to exit the level. Also, the tube was changed to a door, and we animated the door. When the player got the key and collided with the door, the door would “open”, and the player would be able to go through. If you can, try playing with the first level. Here is the link: https://nighthawkcoders.github.io/platformer4x/

Although coding something similar may seem tough, just remember that the hardest part in trying to code in this game is to find the file to put the code in. After that, it is just a few lines of code. However, keep in mind that this process may be repeated multiple times. In my case, here were the files that we changed for this level: (Anything circled in red was changed or added to the original code)

GameSetterHills:

const assets = {  
    obstacles: {
      tube: { src: "/images/platformer/obstacles/doorclosed.png",
      hitbox: { widthPercentage: 0.5, heightPercentage: 0.5},
      width: 52, //87
      height: 81, //125
      scaleSize: 100,
      },
      coin: { src: "/images/platformer/obstacles/coin.png" },
    },
    platforms: {
      grass: { src: "/images/platformer/platforms/grass.png" },
      bricks: { src: "/images/platformer/platforms/brick_wall.png" },
      block: { src: "/images/platformer/platforms/brick_block.png" }, 
      itemBlock: {
        src: "/images/platformer/sprites/key.png",
        sizeRatio: 83.2,
        widthRatio: 1.0,
        heightRatio: 1.0,
        width: 5952, // 204
        height: 6000, // 204
        scaleSize: 10, // 80
        speedRatio: 0.7,
        hitbox: { widthPercentage: 0.4, heightPercentage: -0.2 }
      },
    },
}
<IPython.core.display.Javascript object>

In GameSetterHills, the only thing that was changed were the sprites, as well as their width, height, and scaleSize. Those 3 variables control the size of the sprite when it is displayed on screen. In VSCode, keep in mind that the sprite data will be listed as the width times the height (eg. 500 x 600).

PlayerHills:

// 2. Collision between player right and finishline  
if (this.collisionData.touchPoints.this.right && GameEnv.keyCollected) {
    this.state.movement.right = false;
    this.state.movement.left = true;
    GameEnv.gameObjects[GameEnv.gameObjects.length - 1].updateImg()
    setTimeout(() => {
        this.x = GameEnv.innerWidth + 1;
    }, 1250);
// 3. Collision between player left and finishline
} else if (this.collisionData.touchPoints.this.left && GameEnv.keyCollected) {
    this.state.movement.left = false;
    this.state.movement.right = true;
    GameEnv.gameObjects[GameEnv.gameObjects.length - 1].updateImg()
    setTimeout(() => {
        this.x = GameEnv.innerWidth + 1;
    }, 1250);
}

In PlayerHills, we needed the if statement to check for the key being collected, as well as changing the closed door to the open door. Also, we added a delay so that the player had time to “go through the door” in order to leave the level. The intial lines of the if statements prevent the player from moving befind the door when they collided with it.

Conclusion:

Overall, the most difficult part of this assignment is to find the files in which the code should go. Also, keep in mind that the more creative you are, the better your level would look like. As you can see, it is only a few lines of code that are added.

Here are some ideas to get you started:

  1. Collect All Coins
    • Mechanic: Mario must collect all the coins in the level to trigger the exit.
    • How it works: Once Mario collects the last coin, a special exit point (like a flagpole or warp pipe) appears, allowing him to leave the level.
  2. Defeat All Enemies
    • Mechanic: Mario must defeat every enemy in the level before the exit becomes available.
    • How it works: The game could provide a counter to show how many enemies are left. Once the final enemy is defeated, a victory sound plays, and the exit appears.
  3. Time Challenge
    • Mechanic: Mario must reach a specific location or collect a certain number of items within a time limit to unlock the exit.
    • How it works: If the time runs out, Mario loses a life. If successful, the exit becomes accessible.
  4. Puzzle Completion
    • Mechanic: Mario must solve a puzzle (e.g., moving blocks to a specific configuration, hitting switches in the correct order) to unlock the exit.
    • How it works: The puzzle could involve environmental elements like moving platforms or hidden triggers.
  5. Star Power Activation
    • Mechanic: Mario must find and collect a hidden star item in the level to power up the exit.
    • How it works: Once the star is collected, the exit becomes available, but enemies temporarily speed up or get tougher.
  6. Ally Rescue
    • Mechanic: Mario must find and rescue a trapped ally (e.g., Toad, a Yoshi egg) hidden somewhere in the level.
    • How it works: Once the ally is rescued, they follow Mario, and both must reach a specific point to finish the level.
  7. Environmental Cleanup
    • Mechanic: Mario must “fix” the environment by collecting trash (e.g., broken blocks, debris) or planting flowers in designated spots.
    • How it works: Once the environment is restored, the level exit becomes available.
  8. Coin Race
    • Mechanic: Certain coins appear only for a limited time, and Mario must collect all of them before they disappear to finish the level.
    • How it works: If Mario misses even one coin, the timer resets, and he has to try again.
  9. Boss Fight
    • Mechanic: Instead of a door, Mario encounters a mini-boss or a group of tougher enemies guarding the exit.
    • How it works: Defeating the boss unlocks the way forward.
  10. Build the Exit
    • Mechanic: Mario must find scattered parts of an exit (e.g., a broken bridge, pieces of a warp pipe) and assemble them.
    • How it works: Each piece is hidden or guarded, and once all are collected, the exit activates.