Introduction: How to make a Double Jump Game in Scratch
Watch the full tutorial here – How to make a Double Jump Game in Scratch | Rabbit jumping game in Scratch | Platformer Game
Scratch is a fantastic platform for beginners to learn programming by making games, animations, and interactive stories. Among the many kinds of games, platformers (games where a character jumps over obstacles, possibly across platforms) are especially fun and rewarding.
In this blog post, you will learn:
- How to make a game in Scratch with smooth movement and obstacles
- How to create a double jump game in Scratch — allowing the player to jump once, and then again in mid-air for extra reach
- How to add scoring, game over / winning states, sound, and polish
- How to handle edge cases and enhancements to make the game feel more professional
This tutorial is based on a Scratch game built by Omaansh Aggarwal at Kodex Academy, with rabbits, rocks, trees, and nighttime city backdrops.
Double Jump Game in Scratch: Step‑by‑Step Coding
Here is the complete process, combining the transcript with code snippets you can plug directly into your Scratch project.
Prerequisites
- A Scratch account (scratch.mit.edu) or the offline editor
- Basic familiarity with Scratch: sprites, costumes, backdrops, events, motion blocks, variables
- Optional: graphics / sound assets (but you can use built‑in ones)
1. Setting Up Sprites & Backdrops
- Remove Unneeded Sprites
Delete default or extra sprites you won’t use. - Add Main Character (Rabbit)
- Choose a rabbit sprite
- Resize it (e.g. size = 30%)
- Keep two costumes (for running animation). Delete extra costumes.
- Add Obstacle Sprites
- Trees: resize (e.g. size = 40%)
- Rocks: resize (e.g. size = 25%)
- Set Up Backdrops
- Use a “Night City with Street” backdrop (or whatever you prefer)
- Duplicate the backdrop to create separate “You Win” and “You Lose” screens
- Add text in those backdrops: “You Win” (in light blue, curly font), “You Lose” (in red)
2. Variables
Create the following variables:
Points
(For all sprites) – tracks scoreJumps
(For this sprite only) – tracks how many jumps left (to implement double jump)Y Speed
(For all sprites) – to handle gravity and vertical motion
3. Basic Motion, Gravity, and Double Jump
Here’s how to implement gravity, jump logic, and movement:
Gravity & Ground Detection
when green flag clicked
set [Y Speed] to (0)
set [Jumps] to (0)
go to x: (67) y: (0)
switch backdrop to [Night City with Street]
forever
change [Y Speed] by (-1) // gravity pulling down
change y by (Y Speed)
if <touching color [road color]?> then
set [Y Speed] to (0)
set [Jumps] to (2) // Reset jump count when on ground
end
end
- Use the “touching color” block to detect the ground (road color).
- Reset
Jumps
to 2 so the player can use double jump.
Movement / Horizontal & Respawn
when green flag clicked
forever
if <key [right arrow] pressed?> then
change x by (some speed, e.g. 5)
end
if <touching edge?> then
set [Y Speed] to (0)
go to x: (-167) y: (0) // Respawn position
end
end
4. Double Jump Logic
when [space] key pressed
if <(Jumps) > (0)> then
change [Jumps] by (-1)
set [Y Speed] to (15) // launch upward
end
This lets the player press space to jump, up to two times before touching the ground.
5. Animation (Running)
To make the rabbit look like it’s running:
when green flag clicked
forever
switch costume to [Rabbit A]
wait (0.5) seconds
switch costume to [Rabbit B]
wait (0.5) seconds
end
6. Obstacles: Trees & Rocks
Each obstacle sprite (tree or rock) needs scripts like:
when green flag clicked
hide
wait (2) seconds
show
forever
go to x: (240) y: (3)
glide (4) secs to x: (-240) y: (93) // or adjust as needed
end
This makes them appear after a delay, then glide across the screen toward the player.
7. Collision Detection & Game Over
We need to detect collision between rabbit and obstacles (trees, rocks), and trigger game over:
when green flag clicked
forever
if <touching [tree sprite]?> or <touching [rock sprite]?> then
switch backdrop to [You Lose]
stop [all v]
end
end
Do similar logic in both obstacle sprites or centralized in the rabbit sprite.
8. Scoring & Win Condition
To reward players who avoid obstacles / survive long enough:
when green flag clicked
set [Points] to (0)
forever
// Could be tied to obstacle passed or time survived—here, space key usage is in example but better is time‑based or passing obstacles
wait (1) second
change [Points] by (1)
if <(Points) = (5)> then
wait (0.8) seconds
switch backdrop to [You Win]
stop [all v]
end
end
You can customize “5” to any target score.
9. Sound & Feedback
- When backdrop switches to “You Lose”, play a sound such as Connect, Game Over, etc.
- When the rabbit wins or at some milestone, play celebratory sound: Dance Celebration, Great, etc.
when backdrop switches to [You Lose]
play sound [Connect] until done
// At win
when backdrop switches to [You Win]
play sound [Dance Celebrate] until done
Additional Scenarios & Edge Cases
To make your game robust, handle these scenarios:
- Prevent infinite jumping
If the player holds the space key, avoid repeated jumps beyond the double-jump count. Useif <key pressed> and (Jumps > 0)
rather than a “forever if”. - Peak of jump moment
At the top of a jump, vertical velocity may be zero for a short moment. If logic is based solely onY Speed = 0
to reset jump count, that might accidentally allow a third jump. Better to use touching ground or touching floor color/sprite to resetJumps
. - Falling through ground / glitching
Make sure ground detection is solid (good color picking, or using a “floor” sprite). If using color detection, ensure at all ground pixels the color matches, and the sprite’s shape overlaps enough. - Obstacle spawning collision
Avoid obstacles spawning right on top of the player. Delay, spawn positions, or gliding from edges help. - Difficulty scaling
As the user’s score increases, you may want to increase speed, reduce wait times, add more obstacles, etc.
Full Script Example (Rabbit Sprite)
Putting many things together in one script (rabbit):
// In Rabbit sprite
when green flag clicked
switch backdrop to [Night City with Street]
go to x: (67) y: (0)
set [Y Speed] to (0)
set [Jumps] to (0)
set [Points] to (0)
forever
// Gravity and vertical movement
change [Y Speed] by (-1)
change y by (Y Speed)
// Ground detection (road color)
if <touching color [road color]?> then
set [Y Speed] to (0)
set [Jumps] to (2)
end
// Horizontal movement
if <key [right arrow] pressed?> then
change x by (5)
end
// Respawn if outside edge
if <touching edge?> then
set [Y Speed] to (0)
go to x: (-167) y: (0)
end
// Animation (running)
// Could be separate script, or inside a timer
end
when [space] key pressed
if <(Jumps) > (0)> then
change [Jumps] by (-1)
set [Y Speed] to (15)
end
forever
if <touching [tree sprite]?> or <touching [rock sprite]?> then
switch backdrop to [You Lose]
stop [all v]
end
end
forever
wait (1) seconds
change [Points] by (1)
if <(Points) = (5)> then
wait (0.8) seconds
switch backdrop to [You Win]
stop [all v]
end
end
Enhancement Features & Their Code
1. Health System (Lives Instead of 1-Hit Death)
Why? Allows players to make a few mistakes instead of instant game over. Adds forgiveness and challenge.
How to implement:
- Create a variable:
Lives
(for all sprites) - Set initial lives to 3
- Decrease by 1 when touching obstacle
- Only show “You Lose” when
Lives = 0
Scratch Code:
when green flag clicked
set [Lives v] to (3)
forever
if <touching [tree v] ?> or <touching [rock v] ?> then
change [Lives v] by (-1)
wait (0.5) seconds // prevent multiple hits at once
if <(Lives) = [0]> then
switch backdrop to [You Lose v]
stop [all v]
end
end
end
2. Variable Game Speed / Difficulty Increase
Why? Keeps the game interesting. It gets harder the longer you survive or the higher your score.
How to implement:
- Create a variable:
Speed
- Increase
Speed
over time or per score milestone - Use this to move obstacles faster
Scratch Code:
when green flag clicked
set [Speed v] to (4)
forever
if <(Points) mod 5 = 0> then // every 5 points
change [Speed v] by (1)
wait (1) seconds
end
end
In obstacle sprite (e.g., Tree):
go to x: (240) y: (3)
repeat until <x position < -240>
change x by ((-1) * Speed)
wait (0.05) seconds
end
3. Power-Ups (Shield, Extra Jump, Speed Boost)
Why? Adds fun & strategy. Power-ups can help avoid obstacles or reach score faster.
How to implement:
- Add a power-up sprite (e.g., star, bubble)
- When touched, set
Shield = true
- Temporarily disable collisions or add benefits
Scratch Code:
Create variable: Shield
(for all sprites)
Power-up Sprite:
when green flag clicked
forever
go to x: (240) y: (random -50 to 50)
glide (4) secs to x: (-240) y: (random -50 to 50)
end
when green flag clicked
forever
if <touching [Rabbit v] ?> then
set [Shield v] to [true]
wait (5) seconds
set [Shield v] to [false]
end
end
Rabbit Sprite: Collision Logic
if <<touching [tree v]> or <touching [rock v]>> and <(Shield) = [false]>> then
change [Lives] by (-1)
wait (0.5)
end
4. Parallax Background Effect
Why? Makes the background scroll at different speeds, giving the illusion of depth.
How to implement:
- Add two or more background layers as sprites
- Move them at different speeds
Scratch Code (Background Layer Sprite):
when green flag clicked
go to x: (0) y: (0)
forever
change x by (-1) // slower than foreground
if <x position < -480> then
set x to (480)
end
end
Add multiple layers: front layer (trees) moves faster, back layer (stars, mountains) moves slower.
5. Jump Indicator (Show Remaining Jumps)
Why? Makes it easier for player to understand double-jump mechanic.
How to implement:
- Create a visual representation of jumps left (e.g., circles, text, number)
Scratch Code (Text Label Sprite):
when green flag clicked
forever
if <(Jumps) = (2)> then
switch costume to [2 jumps]
else if <(Jumps) = (1)> then
switch costume to [1 jump]
else
switch costume to [no jumps]
end
end
Or use a text sprite that updates Jumps
:
when green flag clicked
forever
set [JumpsDisplay v] to (join [Jumps Left: ] (Jumps))
end
6. Start / Restart Game Button
Why? Gives players control to start again without reloading the game.
How to implement:
- Add a button sprite
- When clicked, broadcast “Restart”
- Add “When I receive Restart” to all sprites to reset
Button Sprite:
when this sprite clicked
broadcast [Restart v]
In Rabbit and Other Sprites:
when I receive [Restart v]
go to x: (67) y: (0)
set [Y Speed] to (0)
set [Points] to (0)
set [Lives] to (3)
set [Jumps] to (0)
switch backdrop to [Night City with Street]
You can hide “Game Over” text and show again after restart.
7. High Score Tracker
Why? Adds replay value. Players can try to beat their best.
How to implement:
- Use a variable:
High Score
- Compare after game over or win
Scratch Code:
when backdrop switches to [You Win v] or [You Lose v]
if <(Points) > (High Score)> then
set [High Score v] to (Points)
end
Summary of Enhancements & Keywords
Feature | Value | Related Keywords |
---|---|---|
Health system | Game longevity, difficulty | scratch games, scratch game tutorial |
Speed scaling | Replayability | how to make games in scratch |
Power-ups | Engagement | scratch programming games |
Parallax scrolling | Visual quality | scratch programming animation |
Jump indicator | Clarity for players | double jump in scratch |
Restart button | User control | platformer game in scratch |
High score | Competition | scratch games tutorial easy |
Conclusion
Creating a Double Jump Platformer Game in Scratch not only teaches foundational game development concepts like motion, gravity, and collision detection, but also opens the door to creative enhancements that turn a simple game into a polished, fun experience.
In this blog, we’ve walked through the step-by-step process of building the game as explained in the YouTube tutorial by Kodex Academy, and extended it with advanced features like:
- Health and Lives System
- Dynamic Difficulty Scaling
- Power-Ups and Temporary Abilities
- Parallax Background Scrolling
- Jump Indicators for Clarity
- Game Restart Functionality
- High Score Tracking
Whether you’re a beginner or an intermediate Scratch user, these additions will make your game more exciting, engaging, and professional.
Final Takeaways
- Use Scratch not just to replicate games, but to innovate and make them your own.
- Keep your game engaging with progressive challenges.
- Always provide feedback to the player — visual, auditory, and interactive.
- Don’t forget to test and polish — small bugs or glitches can affect gameplay experience
Call to Action
- Don’t forget to check out the full video tutorial: How to make a Double Jump Game in Scratch | Rabbit jumping game in Scratch | Platformer Game
- Like, comment & share the video
- Visit kodexacademy.com
- subscribe to the Kodex Academy YouTube channel for deeper Scratch content.
Happy coding with Kodex Academy! 🚀
Learn More with Kodex Academy
At Kodex Academy, we’re passionate about helping students learn coding in creative ways. This project teaches more than Scratch—it empowers young minds to build tools that work in the real world.
Explore more:
Stay updated with new content, free tutorials, and coding challenges!
- 🌐 Website: https://kodexacademy.com
- 🌐 Website: https://games.kodexacademy.com
- 💬 WhatsApp Channel: Join Now
- 💼 LinkedIn: Kodex Academy
- 📸 Instagram: @kodex_academy
- 𝕏 Twitter: @Kodex_Academy
- 📢 Telegram: Join Our Channel
- 🔗 Patreon: patreon.com/KodexAcademy
Further Reading & Links
- Scratch Wiki Motion Blocks: https://en.scratch-wiki.info/wiki/Motion_Blocks
- Scratch Programming for Beginners: https://scratch.mit.edu/projects/editor
- Scratch Animation Guide: https://en.scratch-wiki.info/wiki/Animating