September 11, 2024

How to Make Your Player Wall Jump in a 2D Platformer

Create a game without coding skills!
CREATE A GAME NOW

This tutorial was put together by our community member shawnBuilds for Rosebud AI, the AI-powered game creation platform. Check out shawn’s games here, and join our Discord to find more tutorials and connect with other creators!

A wall jump happens when a character hits a wall and then jumps off it. It's a fun and challenging way to move in a platformer.

In this quick guide, I'll show you how to write prompts for Rosie to make your player wall jump in a 2D platformer.  We will start with Rosebud's 2D platformer template, which already has a player and level setup for you.

Here is what we'll end up with:

And you can play the project here.

Now, let's get started!  

Setup: Create a new game

To follow along, create a new 2D platformer in Rosebud. Here's how:

1. Open the Rosebud homepage

2. Look for the '2D Platformer' game template at the bottom right

3. Click 'Create Game' button below '2D Platformer'

4. Move with the player with the arrow keys.

Step 1: Add walls to the game

In this step, we will add barriers next to the player, so we can try out the wall jump. These barriers will give us a fun challenge to take on once we can wall jump.  

Submit this prompt to Rosie:

Remove the platforms in the game, and create two walls. Both walls will use the same image as the ground, and will reach up from the ground to about two-thirds of the screen height. Place the left wall from the left edge of the screen to about one-third of the way across. Place the right wall from the right edge of the screen to about two-thirds of the way across.Also, increase the running speed and the force of gravity, and decrease the jump speed, so the player moves faster.

You will see something like this:

Step 2: Check if player can wall jump

With the walls in place, we can check if the player is ready to wall jump when they are not on the ground and are touching a wall.  

Submit this prompt to Rosie:

Hey Rosie, let's check for when the player is ready to wall jump. The player will be ready to wall jump when they are not on the ground and are touching a wall. And, don’t make the player actually wall jump yet. To help us check if everything is working, place a list of golden text labels in the top left corner that are large and bold. The labels will show us when the player can wall jump, whether the player is on the ground, and which side of the player is touching a wall.

You will see something like this:

The text at the top left should say that it's true that the player can wall jump, only when they are not on the ground and are touching a wall.

Step 3: Program the wall jump

Now, we will program the player to jump up and away from the wall when the player is ready to wall jump, and then presses the jump button.  

Submit this prompt to Rosie:

Now, let's make the player wall jump when they are ready to wall jump, and then press the jump button. So, what happens during the wall jump? The player will jump up and away from the wall, moving at a very fast speed in a diagonal direction. Gravity won’t affect the player during the wall jump, which will last for about a quarter second. We also need to add a few step to prevent mistakes. After the wall jump starts, the player can't move back toward the wall for a short time (about a quarter second). This stops the player from canceling the jump.

You will see something like this:

Wrapping Up

Congrats, you've just added a wall jump feature to your 2D platformer! We started by setting up walls, checked when the player is ready to wall jump, and finally made the wall jump happen when the jump button is pressed. Now, you are ready to take on those walls and make your way to the top!

Ready to turn your ideas into games?
GET STARTED NOW