How to Make a Platformer on Scratch: Step-by-Step Tutorial
Last updated: October 2026
To make a platformer on Scratch, give a player sprite arrow-key movement, add a variable that pulls it down a little every frame (gravity), stop the fall when it touches a platform, and let it jump only while it is standing on something. Add a goal to reach, and you have a complete, playable game.
A platformer is the classic side-view game where a character runs, jumps, and lands on platforms. It is one of the most satisfying first big projects in Scratch, because the result is a game the child built themselves. This tutorial walks through eight specific steps to build a working platformer from scratch (no pun intended), with the actual blocks to use and what each one does. Once it works, two extra sections show how to add levels and side-scrolling.
Key Takeaways
- A Scratch platformer teaches movement, gravity, jumping, collision detection, and game design, all in one project.
- Most children aged 9 to 12 with some prior Scratch experience can build a working platformer in 4 to 6 sessions of focused work.
- The platformer pattern is foundational. Once it works, levels (one backdrop per level) and side-scrolling (one
scroll xvariable) are small additions, not a rebuild. - The most common stumbling block is gravity. The fix is straightforward but takes most beginners 1 to 2 attempts to get right.
- Scratch is free, runs in any browser, and saves projects automatically when you sign in.
Table of Contents
- Before You Start
- Step 1: Set Up the Stage and Player
- Step 2: Add Left and Right Movement
- Step 3: Add Gravity
- Step 4: Add the Ground (First Collision)
- Step 5: Add Jumping
- Step 6: Add Platforms
- Step 7: Add a Goal
- Step 8: Polish
- How to Make a Platformer on Scratch With Levels
- How to Make a Side-Scrolling Platformer on Scratch
- What to Build Next
- Frequently Asked Questions
Before You Start
Open Scratch at scratch.mit.edu and click "Create" to start a new project. Sign in if you want the project saved automatically. The interface has three main areas: the Stage (top right, where the game runs), the Sprite list (bottom right, where your characters live), and the Code area (centre, where you build the program by snapping blocks together).
Delete the default cat sprite if you do not want it. Use the Sprite icon (bottom right corner) to choose a new sprite, draw your own, or upload one. For this tutorial, any single small sprite will work as the player.
Step 1: Set Up the Stage and Player
First, create the basic scene:
- Click the Backdrop icon (bottom right) and choose a backdrop, "Blue Sky" or "Hills" work well for a platformer
- Make sure your player sprite is selected in the Sprite list
In the Code area, drag these blocks together:
when [flag] clicked
go to x: -200 y: -100
What this does: When the green flag is clicked, the player sprite moves to the bottom-left of the stage. This is your starting position.
Click the green flag to test. Your player should appear in the bottom-left corner.
Step 2: Add Left and Right Movement
Now make the player move with arrow keys. Add these blocks to your existing code:
when [flag] clicked
go to x: -200 y: -100
forever
if <key [right arrow] pressed?> then
change x by 5
end
if <key [left arrow] pressed?> then
change x by -5
end
end
What this does: The forever loop runs continuously, checking each frame whether the right or left arrow is pressed. If right is pressed, the sprite moves 5 pixels to the right. If left is pressed, 5 pixels to the left.
Click the green flag and try the arrow keys. The player should move smoothly left and right.
Step 3: Add Gravity
Real platformers need gravity. The player should fall when they are not standing on something. Add a variable to track vertical speed:
- Click Variables (orange) in the block palette
- Click Make a Variable, name it
y velocity, click OK - Uncheck the box next to
y velocityso it does not show on screen
Now modify your code to handle gravity:
when [flag] clicked
go to x: -200 y: -100
set [y velocity] to (0)
forever
change [y velocity] by (-1)
change y by (y velocity)
if <key [right arrow] pressed?> then
change x by 5
end
if <key [left arrow] pressed?> then
change x by -5
end
end
What this does: y velocity starts at 0. Each frame, gravity pulls it down by 1, so the player accelerates downward. The player's y position changes by the current velocity each frame.
Click the green flag. The player should fall off the bottom of the screen. That is gravity working, but you have not yet given them anything to land on.
Step 4: Add the Ground (First Collision)
To stop the player falling forever, you need ground. Create a new sprite called "Ground":
- Click the Sprite icon → Paint
- Draw a long, thin rectangle (use the Rectangle tool)
- Position it across the bottom of the stage
Now make the player stop when they touch the ground. Modify your forever loop:
forever
change [y velocity] by (-1)
change y by (y velocity)
if <touching [Ground]?> then
change y by (1)
repeat until <not <touching [Ground]?>>
change y by (1)
end
set [y velocity] to (0)
end
if <key [right arrow] pressed?> then
change x by 5
end
if <key [left arrow] pressed?> then
change x by -5
end
end
What this does: When the player touches the ground, the code pushes them up one pixel at a time until they are no longer touching, then resets their vertical velocity to 0 (so they stop falling).
Click the green flag. The player should now fall and land on the ground, then sit there until you press an arrow key.
In 20+ years of teaching kids to code, collision is the step where I have seen children stall most often, and it is hard to debug alone because the blocks look correct even when the behaviour is wrong. This is the kind of moment where a 1-on-1 online Scratch lesson earns its hour: the session is built around your child's own project, and a good tutor asks what each block is doing rather than fixing it for them.
Step 5: Add Jumping
Add jumping to the same forever loop. The trick: the player can only jump when they are touching the ground, otherwise they could double-jump infinitely.
forever
change [y velocity] by (-1)
change y by (y velocity)
if <touching [Ground]?> then
change y by (1)
repeat until <not <touching [Ground]?>>
change y by (1)
end
set [y velocity] to (0)
if <key [up arrow] pressed?> then
set [y velocity] to (12)
end
end
if <key [right arrow] pressed?> then
change x by 5
end
if <key [left arrow] pressed?> then
change x by -5
end
end
What this does: After the player lands and the velocity is reset to 0, the code checks if the up arrow is pressed. If so, it sets the velocity to 12 (a sudden upward push). Gravity then pulls the player back down naturally.
Click the green flag and try jumping. The player should now jump in a smooth arc and land back on the ground.
Step 6: Add Platforms
Now make jumping useful. Create more platforms:
- Right-click the Ground sprite, choose Duplicate
- Move the new platform up and to the right
- Repeat for as many platforms as you want
Important: in your player's code, replace touching [Ground]? with the Sensing block touching color [ ]? (Scratch spells it "color"). Click the colour swatch in that block, then click the eyedropper icon and click on a platform. Click the middle of the platform, not its edge: the Scratch Wiki warns that shape edges can be softened on the stage, so an edge pixel may be a slightly different colour.
This way, the player lands on any object of that colour, not just the original Ground sprite.
if <touching color [#5B5B5B]?> then // your platform colour
Click the green flag and jump between platforms. You should be able to jump up and reach platforms above the starting position.
Step 7: Add a Goal
A platformer needs an ending. Add a goal sprite the player must reach:
- Add a new sprite (a star, a flag, or anything)
- Position it somewhere reachable but not trivial
In the player's code, add this block at the bottom of the forever loop, just before the end:
if <touching [Goal]?> then
say [You won!] for (3) seconds
stop [all]
end
What this does: When the player touches the goal, the game says "You won!" and stops everything.
Click the green flag, navigate to the goal, and confirm the win condition works.
Step 8: Polish
The basic game works. Now make it feel better:
Add a death zone. If the player falls below the stage, restart their position:
if <(y position) < (-179)> then
go to x: -200 y: -100
set [y velocity] to (0)
end
Add walking animation. If your sprite has multiple costumes, switch between them when the player is moving:
if <key [right arrow] pressed?> then
change x by 5
next costume
end
Add jumping sound. Click Sounds at the top of the Code area, choose a "Boing" or similar sound, then in your code, when you start a jump:
if <key [up arrow] pressed?> then
set [y velocity] to (12)
start sound [Boing]
end
Add a score. Make a score variable, and increase it when the player collects items (add coin sprites that disappear when touched).
Each polish step takes 5 to 15 minutes and makes the game noticeably more satisfying. The polish is what turns "I built a platformer" into "I built a game I want to show people."
How to Make a Platformer on Scratch With Levels
Once one screen works, the simplest way to add levels is one backdrop per level, with the floor and platforms painted straight onto it. This is the method the Scratch Wiki uses in its How to Make a Basic Platformer tutorial, and it works because your player already checks for a platform colour (Step 6), not a particular sprite. Three colours do all the work: one for platforms, one for danger, and one for the exit.
Paint the levels:
- Click the Stage (bottom right), then the Backdrops tab at the top
- Paint one new backdrop per level and name them
Level 1,Level 2, and so on, using the name box at the top left of the paint editor. Avoid names that are just a number, because a backdrop named2is easy to confuse with backdrop number 2 - Paint the floor and platforms in black on every level. In the colour palette, drag Brightness to 0 to get pure black, so every level matches exactly
- Paint red where the player must not go (lava, spikes) and yellow where the level ends
- Add one last backdrop named
You Winwith a message on it - Delete the platform sprites from Step 6, the Ground sprite, and the Goal sprite from Step 7. Sprites appear on every level, and the painted colours now do their jobs
Now point the player at the painted colours. In the touching color [ ]? block from Step 6, use the eyedropper on a black platform. Drag in two more touching color [ ]? blocks and set them to the red and the yellow the same way.
Update the player's code. Add show and switch backdrop to [Level 1] at the top, remove the Step 7 touching [Goal]? check, and add two colour checks at the bottom of the forever loop:
when [flag] clicked
show
switch backdrop to [Level 1]
go to x: -200 y: -100
set [y velocity] to (0)
forever
...gravity, landing, jumping, arrow keys and death zone, as before...
if <touching color [red]?> then
go to x: -200 y: -100
set [y velocity] to (0)
end
if <touching color [yellow]?> then
go to x: -200 y: -100
set [y velocity] to (0)
switch backdrop to [next backdrop]
end
end
Then add a second, separate script to the player:
when backdrop switches to [You Win]
hide
stop [all]
What this does: Red sends the player back to the start of the level they are on. Yellow sends them to the start and switches to the next backdrop, which is the next level (next backdrop is one of the options in the switch backdrop to dropdown, and sprites can switch the backdrop, so no code goes on the Stage). When the backdrop reaches You Win, the player hides and the game stops. The show at the top brings the player back when you click the green flag again.
Click the green flag and walk into the yellow area on Level 1. The backdrop should change to Level 2, with the player back at the start.
Two details matter here. Every level starts the player at x: -200, y: -100, so each level needs a platform under that spot. And keep red and yellow out of the rest of the scenery, including shades close to them: the Scratch Wiki notes that touching color can report true for a colour that is similar to, but not exactly, the one you picked.
How to Make a Side-Scrolling Platformer on Scratch
In a side-scroller, the player stays in the middle of the screen and the world slides past, so a level can be far wider than the stage. Scratch has no camera, so you fake one with a variable. The Scratch Wiki calls this the "Traditional Method" in its Scrolling (sprites) guide. It is a different way to make the game bigger than backdrop levels, so build it on a copy of your Step 8 game (File > Save as a copy), not on the levels version.
Make the camera variable. Click Make a Variable, name it scroll x, and choose For all sprites, because every platform needs to read it.
Move the world instead of the player. In the player's code, put the player in the middle of the stage, start scroll x at 0, and make the arrow keys change scroll x instead of x:
when [flag] clicked
go to x: 0 y: -100
set [y velocity] to (0)
set [scroll x] to (0)
forever
...gravity, landing, jumping, goal and death zone, as before...
if <key [right arrow] pressed?> then
change [scroll x] by (-5)
end
if <key [left arrow] pressed?> then
change [scroll x] by (5)
end
end
Pressing right makes scroll x smaller, which slides the world left, so the player appears to walk right. If you added the Step 8 walking animation, keep next costume inside the arrow checks. Update the Step 8 death zone to match: go to x: 0 y: -100 and set [scroll x] to (0), so a fall rewinds the whole level.
Give every platform a place in the world. Add this script to each platform sprite and to the Goal sprite, with a different number in each:
when [flag] clicked
forever
set x to ((scroll x) + (300))
if <([abs] of ((scroll x) + (300))) > (240)> then
hide
else
show
end
end
What this does: 300 is where this platform sits in the level, counted from the centre of the stage, and it must be the same number in both places in the script. The stage is 480 wide, so 480 is one full screen to the right and 960 is two. The abs of block is in Operators, with abs chosen in its dropdown. The hide and show part matters because Scratch keeps sprites from leaving the stage, so without it, platforms that should be off-screen pile up at the edge. 240 is half the stage width, so a platform hides once its centre scrolls past the edge.
Leave the Ground sprite without this script. It stays where it is and acts as an endless floor, and a plain strip looks the same whether it moves or not.
Click the green flag and hold the right arrow. The player should stay in the middle while platforms slide in from the right and disappear off the left.
What to Build Next
Once your basic platformer works, the natural next projects are:
A title screen and a game over screen. A finished game usually opens on a title screen and offers a Retry button when the player loses. Our start screen and game over screen tutorial builds both with the same switch backdrop to block used in the levels section.
Enemies. Add sprites that move automatically. If the player touches one, they restart. This introduces obstacle logic and makes the game harder.
Power-ups. Add items that change the player's abilities temporarily (faster movement, higher jumps, ability to fly).
Time challenge. Add a timer that counts up. Players try to finish faster on each attempt.
For more project ideas at this level, see our best coding projects for kids age 8 to 10 and our summer coding at home: 30 project ideas guides.
A finished platformer is also a useful marker on a much longer path. In our five-year roadmap from Scratch to AI, a multi-level platformer sits in year two, around ages 9 to 10, which is the stage just before a child starts bumping into the limits of Scratch and becomes ready for Python.
Frequently Asked Questions
What age can kids build a Scratch platformer? Most children aged 9 to 12 with some prior Scratch experience can build a working platformer over 4 to 6 sessions. Children younger than 9 sometimes struggle with the gravity and collision logic, which involves more abstract thinking than simpler Scratch projects. A child completely new to Scratch should typically build 3 to 4 simpler projects (Catch game, Maze, Quiz) before attempting a platformer.
How long does it take to make a platformer in Scratch? A basic working platformer takes most children 4 to 6 hours of focused work, typically spread across 4 to 6 sessions. Adding polish (animations, sounds, multiple levels, enemies) can extend this to 10 to 15 hours. The result is a substantial project the child can be genuinely proud of and share.
Why does my Scratch platformer character glitch through the ground?
The most common cause is the gravity step being too large. If y velocity reaches values larger than 10 to 15, the player can move past the ground in a single frame before the collision check runs. Either reduce gravity (change by smaller amounts) or split the movement into smaller steps that check collision more frequently.
How do I make the camera follow the player in Scratch?
Scratch does not have a true camera, but you can simulate one by moving all the platforms and obstacles instead of moving the player horizontally. Keep the player's x position fixed in the middle of the stage, and when the player presses right, lower a scroll x variable instead of changing x. Each platform then runs set x to ((scroll x) + (its place in the level)), so the whole world slides left. The side-scrolling section above has the exact blocks. It is more advanced than a basic platformer but is a logical next step.
Can a Scratch platformer be turned into a real published game? Scratch platformers can be shared on the Scratch website (scratch.mit.edu) where other children play and remix them. To publish a "real" game on app stores or game platforms, the child eventually needs to learn a more powerful tool, typically Python with Pygame or another game engine. Scratch is genuinely valuable as a starting point but has clear limits at the publishing stage.
What if my child can't get the platformer working? If your child is consistently stuck on this project, the foundation might be the issue rather than the project. Most platformer struggles come from missing concepts (variables, conditionals, sequencing) that are easier to master through smaller projects first. See our signs your child is ready for coding lessons and when coding makes kids upset guides for what to do.
Related Articles
- What Is Scratch and Is It Good for Learning to Code?, Everything parents need to know about Scratch.
- Best Coding Projects for Kids Age 8-10, Simpler Scratch projects to build before a platformer.
- Online Scratch Tutor for Kids: What a Lesson Looks Like, When to consider a tutor for Scratch projects.
- Summer Coding at Home: 30 Project Ideas, More project ideas across Scratch, Python, and AI.
Want a tutor's help guiding your child through their first Scratch platformer? Book a free Discovery Call, 30 minutes, no obligation, and you'll leave with a clear plan for what to build next.
Keep reading
More guides for parents on the same topics.