How to make a Double Jump Game in Scratch | Platformer game in Scratch | Step by Step Coding

How to make a Double Jump Game in Scratch Platformer game in Scratch Step by Step Coding

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

  1. Remove Unneeded Sprites
    Delete default or extra sprites you won’t use.
  2. Add Main Character (Rabbit)
    • Choose a rabbit sprite
    • Resize it (e.g. size = 30%)
    • Keep two costumes (for running animation). Delete extra costumes.
  3. Add Obstacle Sprites
    • Trees: resize (e.g. size = 40%)
    • Rocks: resize (e.g. size = 25%)
  4. 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 score
  • Jumps (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:

  1. Prevent infinite jumping
    If the player holds the space key, avoid repeated jumps beyond the double-jump count. Use if <key pressed> and (Jumps > 0) rather than a “forever if”.
  2. Peak of jump moment
    At the top of a jump, vertical velocity may be zero for a short moment. If logic is based solely on Y Speed = 0 to reset jump count, that might accidentally allow a third jump. Better to use touching ground or touching floor color/sprite to reset Jumps.
  3. 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.
  4. Obstacle spawning collision
    Avoid obstacles spawning right on top of the player. Delay, spawn positions, or gliding from edges help.
  5. 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:

  1. Create a variable: Lives (for all sprites)
  2. Set initial lives to 3
  3. Decrease by 1 when touching obstacle
  4. 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:

  1. Add a power-up sprite (e.g., star, bubble)
  2. When touched, set Shield = true
  3. 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:

  1. Add a button sprite
  2. When clicked, broadcast “Restart”
  3. 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

FeatureValueRelated Keywords
Health systemGame longevity, difficultyscratch games, scratch game tutorial
Speed scalingReplayabilityhow to make games in scratch
Power-upsEngagementscratch programming games
Parallax scrollingVisual qualityscratch programming animation
Jump indicatorClarity for playersdouble jump in scratch
Restart buttonUser controlplatformer game in scratch
High scoreCompetitionscratch 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

  1. 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
  2. Like, comment & share the video
  3. Visit kodexacademy.com
  4. 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!

Further Reading & Links

Recent Posts

How to Make a Math Racing Game in Scratch | Game Concepts and Complete Tutorial

In this tutorial, you’ll learn to build a Math Racing Game in Scratch. Players solve math problems to move their character forward; wrong answers benefit the opponent. It’s a race of speed, accuracy...

How to make Memory Skill Game in Scratch | Card Matching Game in Scratch – Part 2 | Step-by-Step Coding

In this tutorial you'll learn how to make memory skill game in Scratch / card matching game in Scratch. This is a great beginner‑to‑intermediate project for scratch tutorial game, scratch programming...

How to make a Card Matching Game in Scratch | Memory Skill Game in Scratch – Part 1 | Step-by-Step Coding

In this Scratch tutorial, we'll walk you through how to make a card matching game in Scratch, also known as a memory game or skill game. This is a popular beginner project that introduces essential...

Create a Quiz Game in Scratch | Spelling Test in Scratch | Picture Identification in Scratch

Want to make learning spelling fun, visual, and interactive? In this Scratch tutorial, you'll learn how to make a spelling quiz game in Scratch using picture identification, text-to-speech, and...

How to make a Double Jump Game in Scratch | Platformer game in Scratch | Step by Step Coding

How to make a Double Jump Game in Scratch. Scratch is a fantastic platform for beginners to learn programming by making games, animations, and interactive stories. Among the many kinds of games...

How to Use Variables in Scratch | Variable Blocks in Scratch | Complete Tutorial

Introduction: Variable Blocks in Scratch Whether you’re just getting started with Scratch programming or looking to take your projects to the next level, understanding variables and lists is...

How to Make Earth Revolve Around the Sun in Scratch: A Complete Tutorial & Enhancements

Animating Earth revolving around the Sun is a classic beginner/intermediate Scratch animation project. It combines trigonometry (sine & cosine), variables, loops, and visual scripting. Kids can learn...

How to Make a Game in Scratch | Snake Game in Scratch | Step-by-Step Game Coding

In this tutorial, we’ll build a Snake Grid style game in Scratch step by step (very similar to the Kodex Academy example). By doing this, you’ll cover many of the core Scratch building blocks. We will...

How to Use Operator Blocks in Scratch | Full Guide with Live Coding & Examples

One of the most powerful features in Scratch is its Operator Blocks — essential for handling math operations, logic comparisons, and string manipulations...

How to Create a Thirsty Crow Story in Scratch | Animation Story in Scratch for Kids

In this tutorial, you’ll learn how to create the classic “Thirsty Crow” story in Scratch, using simple animation, voice, and sprite actions. This is a perfect project for kids who are new to coding...

How to Create a Dodge Ball Game in Scratch: A Complete Step-by-Step Tutorial for Beginners

This step-by-step tutorial will guide you through how to create a Dodge Ball game in Scratch from scratch! In this game, you’ll control a character trying to dodge falling balls, earn points, and...

How to use Sensing Blocks in Scratch | Scratch programming for beginners | Live Coding with Examples

In today’s session, we’re diving deep into one of the most powerful features of Scratch — Sensing Blocks. These blocks allow your projects to interact with the world, detect touches, respond to...

Build an Egg Shooting Game in Scratch: Step-by-Step Coding | Complete Guide for Beginners

Learn how to create a fun, interactive shooting game in Scratch with this detailed tutorial inspired by classic arcade games. Perfect for kids and beginners looking to dive into Scratch programming!...

How to Make a Maze Game in Scratch | Step by Step Coding | Full Tutorial & Enhancements

Introduction: Why Build a Maze Game in Scratch? If you’re looking for a Scratch beginner project idea that’s fun, interactive, and educational, then building a maze game in Scratch is the...

Scratch Control Block Tutorial: Full Guide with Loops, Conditions, Cloning & Code Examples

“Control blocks” in Scratch are those blocks (from the Control category) that manage the flow of your script: when things happen, how many times they happen, making decisions, repeating actions...

How to Create a Car Racing Game in Scratch – Part 2 – Step-by-Step Coding

Welcome to your ultimate guide on how to make a car racing game in Scratch—a step‑by‑step tutorial. You'll learn Scratch game development techniques, see actual code blocks, and discover enhancements...

How to Make a Hurdle Jumping Game in Scratch – Build a Fun Hurdle Runner with Score & Win Screen

Are you ready to create your very own hurdle jumping game in Scratch—just like the iconic Chrome Dino or Super Mario? 🎮 Whether you're new to Scratch or just looking for your next fun project, this...

How to Create a Car Racing Game in Scratch – Part 1 – Step-by-Step Coding

In this Scratch car racing game tutorial, we’ll walk you through how to create a fully functional, visually exciting, and incredibly fun car racing game using Scratch. In this blog, we’ll cover: How...
Scroll to Top