How to Make a Character (Sprite) Jump in Scratch

Ryan Barone
February 12, 2026

To make a character jump in Scratch, you need to: (1) code the upward movement using a 'repeat' block that increases the y position by 10 for 15 iterations, and (2) code gravity using a 'repeat until' block that decreases the y position by 10 until the character touches the ground color. This creates the illusion of jumping and falling.

Follow along for more details, tips, and troubleshooting. 

---

Creating a platformer game in Scratch is a fun and engaging way to learn coding. Within that, jumping is a key mechanic in such games, allowing characters to move from platform to platform. According to MIT Media Lab (Scratch's creator), over 100 million projects have been created on Scratch, with platformer games among the most popular project types for teaching fundamental programming concepts.

Here are a few key terms to know before getting started, followed by a step-by-step guide to making your Scratch sprite jump.

  • Sprite: A character or object in Scratch that can be programmed to move and interact.
  • Costume: Different appearances of the same sprite (e.g., facing left vs. right).
  • Y Position: The vertical location of a sprite (higher y = higher on screen).
  • X Position: The horizontal location of a sprite (higher x = further right).
  • Color Detection: A Scratch feature that detects when a sprite touches a specific color, used here to detect ground/platform contact.

1. Set Up Your Game Environment

Create the Ground and Platforms

  • Draw a Ground sprite for your character to stand on.
  • Add Platform sprites for your character to jump onto.

TIP: Make sure the top color of the platforms matches the color of the ground exactly. If you look at the example below, both the ground and the platform tops are light purple.

Position and Resize Sprites

  • Arrange your ground, platforms, and character sprite in the game preview window to build your basic game layout.

sprite character jumping onto platforms

Step 2: Prepare the Character Sprite

Add Costumes for Directional Movement

Your sprite should have at least two costumes: Right and Left. This will allow the character to turn when the arrow keys are pressed.

  • Draw the character facing the right side of the screen.
  • Right-click the costume and select Duplicate.
  • Highlight the entire character, then click Flip Horizontal to create the left-facing version.

gif of a scrtch character turning left and right

Step 3: Code Character Movement

Moving Right and Left

Select the character sprite and add the following code:

1. Select the player character sprite and add "when right arrow key pressed" to the code area. 
2. Attach a "switch costume to Right" and "change x" block with a value of "20." 
3. Right-click and "Duplicate" the code block, and change the key to left arrow. 
4. Change the costume to "Left" and the "x" value to "-20."

DirectionKeyCostumeX Change
RightRight ArrowRight+20
LeftLeft ArrowLeft-20

screenshot of scratch blocks for player movement

Step 4: Code the Jumping Mechanic

Jumping Up

In Scratch, jumping up is achieved by changing the character's y position.

First, add a "when up arrow key pressed" to the code area. Then, attach a "repeat" block set to "15," and place "change y" by "10" inside of it.

Falling Back Down

When jumping in real life, gravity naturally brings you back to the ground. In Scratch, you'll need to code this manually.

  1. Attach a "repeat until <>" block under the previous repeat block.
  2. Click the "color" variable" and then select the eyedropper tool from the "color" menu. 
  3. Hover over the "Ground" color and then click to select it. 
  4. Inside the "repeat until" block, add "change y" by "-10."

gif showing how to use the eyedropper tool in scratch

TIP: If there's a platform directly above your character, you might get stuck on the first jump. This happens because the top of your character is technically touching the ground color, and so it thinks it doesn't need to fall! Here is a fix:

In the "repeat 15" block, attach an "if <> then" block under the "change y" block. Then, add the color to the "if" brackets and select the bottom color of the platform and inside the "if" block, add "change y" by "-10."

Next Steps

And with all of that, your child should be well on their way to completing their Scratch creation—jumping and all! For additional Scratch tutorials and official documentation, visit the Scratch Wiki, and for more advanced jumping mechanics like variable jump height, see the Scratch community tutorials on platformer physics.

If your child is looking to take the next step in guided instruction, check out our many summer camps in ScratchScratch coding classes, or Online Private Lessons.  

 

A: This occurs when the platform color doesn't exactly match the ground color. The 'repeat until touching [color]' block can only detect the specific color you selected. Ensure all platform tops are the exact same color as the ground. Use the eyedropper tool to sample the ground color directly.

A: To jump higher, increase the value in the 'change y by' block inside the 'repeat 15' block (e.g., change from 10 to 15). To jump lower, decrease it (e.g., change from 10 to 5). You can also increase or decrease the repeat count from 15 to make the jump longer or shorter.

A: Yes. To make gravity faster (character falls quicker), increase the 'change y by -10' value to -15 or higher. To make gravity slower, decrease it to -5 or lower. You can also adjust the repeat count in the falling block to control fall duration.

A: Add an 'if touching [platform bottom color]' block inside your 'repeat 15' jumping block. Inside the 'if' block, add 'change y by -10' to push the character down if they touch the platform bottom while jumping. This prevents them from becoming stuck.

A: No. Since all platforms use the same ground color (as recommended in Step 1), a single 'repeat until touching [ground color]' block detects landing on any platform. The character will stop falling when touching any surface with that color.

A: Yes, but it requires additional code. You would need to create a variable to track whether the character is in the air, and allow a second jump only if they haven't already used it. This is an advanced technique beyond the basic jumping mechanic covered here.

Meet iD Tech!

Sign up for our emails to learn more about why iD Tech is #1 in STEM education! Be the first to hear about new courses, locations, programs, and partnerships–plus receive exclusive promotions! Online camps, Roblox coding classes, ai for kids, and more. 

By signing up you agree to our Privacy Policy
Subscribe & Save!

Meet iD Tech!

Sign up for our emails to learn more about why iD Tech is #1 in STEM education! Be the first to hear about new courses, locations, programs, and partnerships–plus receive exclusive promotions! Online camps, Roblox coding classes, ai for kids, and more. 

By signing up you agree to our Privacy Policy

Meet iD Tech!

Sign up for our emails to learn more about why iD Tech is #1 in STEM education! Be the first to hear about new courses, locations, programs, and partnerships–plus receive exclusive promotions! Online camps, Roblox coding classes, ai for kids, and more. 

By signing up you agree to our Privacy Policy
Subscribe & Save!

Meet iD Tech!

Sign up for our emails to learn more about why iD Tech is #1 in STEM education! Be the first to hear about new courses, locations, programs, and partnerships–plus receive exclusive promotions! Online camps, Roblox coding classes, ai for kids, and more. 

By signing up you agree to our Privacy Policy