Introduction: Minecraft 2D Platformer Game - Build Tutorial

Hello! Today I will be showing you how to make a 2D Platformer Game inside Minecraft. The game will be similar to Super Mario Bros, but customizable with all the features within Minecraft! No mods or external editing programs are required.

Before we start, I will be using sample coordinates and blocks for this demonstration. If you know your way around commands, feel free to change the provided commands to customize your build.

Step 1: Setting Up the World

First, start up Minecraft: Java Edition in version 1.12.2. This should work in other versions as long as they support the required commands. It should also work on other versions of Minecraft, but I have only tested it in Java Edition.

Start a new world or use one of your existing worlds. Superflat works way better, but you can use a normal world if you clear out a space for this build. If you make a new world, make sure you turn on Allow Cheats and start the world in Creative Mode.

First, we have to set a few parameters for the world.

Type the following command:

/gamerule commandBlockOutput false

and if you want it to always be day, type the following command:

/gamerule doDaylightCycle false

Finally, I will be using the coordinates around the (0, g, 0) area, where g represents the ground height of your world. If you want to customize your build to go into another area, change all coordinates to where you want it. Otherwise, type this command to go to the building area:

/tp 0 ~ 0

You are now ready to start building!

Step 2: Building the Walls

Now, we can build the walls that the character will move in. Since we are making a 2D Game, there will be 2 1-block wide areas for a 3rd person view. I will be calling these planes:

  1. The viewport plane, which will house an entity that mirrors the player's position, and the plane that the player will look at
  2. The movement plane, which will make sure the actual player does not move on the Z axis (back and forward).

For simplicity, this build will be facing South, towards positive Z. That means X is left/right, Y is up/down, and Z is forward and backward.

First, we will build the wall that will contain the player. We can start with the back wall of the movement plane.

Type the following command while on the ground:

/fill 0 ~ -1 -20 ~100 -1 minecraft:stone

You can change the position/dimensions here, as long as you change all of the other commands. You can change the stone to any other block, but it doesn't matter too much because the player won't see this wall.

If you look behind you, there should be a giant stone wall.

Now, we will build the front wall of the movement plane. Type the following command while on the ground:

/fill 0 ~ 1 -20 ~100 1 minecraft:barrier

Match the X1, X2, Y1, and Y2 values to match the ones in the previous command if you changed them. You can change minecraft:barrier to any transparent block. Barriers are preferred because they are completely invisible, but you can use glass.

Now, we will build the sides of the movement plane. Type the following command while on the ground:

/fill 0 ~ 0 0 ~100 0 minecraft:stone

then type (while on the ground):

/fill -20 ~ 0 -20 ~100 0 minecraft:stone

Now, your movement plane is complete!

We will now build the viewport plane. Type the following command while you're on the ground to make the back wall:

/fill 0 ~ 30 -20 ~100 30 minecraft:stone

Then, type the following command while you're on the ground to make the front wall:

/fill 0 ~ 28 -20 ~100 28 minecraft:barrier

Your viewport plane is complete!

Finally, we can add walls to the sides to make our game a box. This step is not required, but it looks better with side walls.

For the left wall, type (while on the ground):

/fill 0 ~ 30 -20 ~100 30 minecraft:stone

and for the right wall:

/fill -20 ~ 0 -20 ~100 30 minecraft:stone

Your structure is complete! Now, we have to start building the course.

Step 3: Build Your Course!

Now, it's time to start building the level your character will play.

To build your course, just put any blocks inside the movement plane, between the front wall and the back wall. Remember, your character will start from the bottom, and move all the way to the top.

Get creative! Take advantage of Minecraft's unique physics. You can use any blocks you want, including slime blocks, lava, water, and even redstone!

Your character will have Jump boost, so they can jump to the higher-up blocks. You can make very unique parkour challenges!

After you are done building your course, type the following command to transfer it over to the viewport plane. You will have to type this command once you're done building (while standing on the ground):

/clone -1 ~ 0 -19 ~100 0 -19 ~ 29

You will also have to type this command any time you make changes to the course. After typing this command, you should see your course, reflected on the viewport plane!

Step 4: 2D Mechanics

Now is the hard part. We have to set up command blocks for the 2D part.

You need command blocks for this part. To get one, type:

/give @p minecraft:command_block

A command block should drop into your inventory.

First, we will set up the command block that gives you jump boost. Place a command block down, anywhere outside the box. Change the command block to Repeat, Unconditional, and Needs Redstone. Enter the command into the command block:

/effect @a[tag=2DPlayer] minecraft:jump_boost 2 5 true

Put a lever on the command block and turn the lever on. You can change the "5" to whatever jump boost amount you want.

Place down another command block. Change it to repeat, unconditional, and needs redstone. Enter the command into the command block:

/execute @a[tag=2DPlayer] ~ ~ ~ /tp @p ~ ~ ~ 0 0

Place a lever and turn it on.

Finally, place another command block. Set it to repeat, unconditional, and needs redstone. Enter the command:

<p>/execute @p[tag=2DPlayer] ~ ~ ~ /teleport @e[tag=2DMirror] ~ ~ 29</p>

Place a lever and turn it on.

Note: /teleport is used instead of /tp because /tp targets the command block, while /teleport targets the executing entity.

Now, we have to make the reflection.

Place an armor stand. You can put whatever armor you want, even a creeper head!

Now, stand right next to the armor stand, and type the following command:

/scoreboard players tag @e[r=5,type=armor_stand] add 2DMirror

Step 5: Entryway and Exit

Our final step is to add the entry and exit.

For the entry, mine two blocks on the left wall from the movement plane, so you can exit the box. Make a corridor, which can be filled with anything you want.

Have two command blocks (impulse, unconditional, needs redstone) in the ground with pressure plates on top, at least one block apart from each other. Make sure the ceiling is only 2 blocks high so the player can't jump over the pressure plate!

The first command block (the first one in the tunnel) will have the following command:

/scoreboard players tag @p remove 2DPlayer

The second command block (should come after the first one) will have this command:

/scoreboard players tag @p add 2DPlayer

This way, the player gets put into 2D Mode when entering. If they decide to exit, they exit 2D Mode.

The entryway command block layout is shown in the video above.

Finally, we have to make sure the player exits 2D Mode when finishing the course. At the exit, place a command block in the ground with a pressure plate on top. Make sure this is unskippable by having a 2-block high ceiling. Set the command block to impulse, unconditional, and needs redstone and enter the command:

/scoreboard players tag @p remove 2DPlayer

Your game is now done!!

Step 6: Playing Your Game!!

The last step is to play your game!

The recommended settings:

  • Adventure mode
  • Feather Falling Boots (if you don't want to take fall damage)
  • HUD and GUI turned off (press F1 (or Function+F1) to toggle)
  • Clouds Off

Have fun with your game! Remember, you can change your course whenever you want, so experiment with different levels! Feel free to post your map online to share your project!

Minecraft Challenge 2018

Participated in the
Minecraft Challenge 2018

Epilog Challenge 9

Participated in the
Epilog Challenge 9

First Time Author Contest 2018

Participated in the
First Time Author Contest 2018