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

Scratch Game

Introduction to 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, 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, and how to add scoring, game over / winning states, sound, and polish.

What You Will Learn:

This comprehensive guide teaches you how to:

  • Create a platformer game with double jump mechanics
  • Implement gravity and jumping physics
  • Add collision detection for platforms and obstacles
  • Use variables for game state management
  • Program player controls and movement
  • Add scoring, lives, and win/lose conditions
  • Enhance the game with power-ups, parallax backgrounds, and more

This project is perfect for intermediate Scratch users who want to learn advanced game mechanics and physics simulation.

Project Overview: What You'll Build

In this game:

  • The player controls a rabbit sprite that moves across a cityscape
  • Obstacles like trees and rocks glide from right to left
  • The player can jump once and then double jump in mid-air
  • Collision with obstacles ends the game or reduces lives
  • Score increases over time; reach a target score to win
  • Game over and win screens with sound effects

This is an excellent project for learning physics, collision detection, and game state management in Scratch.

Prerequisites

Before starting this tutorial, you should have:

  • 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)

Step-by-Step Coding Guide

1. Setting Up Sprites & Backdrops

Start by preparing your project:

  • Delete unneeded sprites
  • Add a rabbit sprite, resize to 30%, keep two costumes for animation
  • Add tree and rock sprites, resize appropriately
  • Set up backdrops: Night City with Street, plus You Win and You Lose screens

2. Variables

Create the following variables:

  • Points (for all sprites) – tracks score
  • Jumps (for rabbit) – tracks remaining jumps
  • Y Speed (for all sprites) – handles gravity and vertical motion
  • Lives (optional, for health system)

3. Basic Motion, Gravity, and Double Jump

Implement core mechanics:

when green flag clicked
set [Y Speed v] to (0)
set [Jumps v] to (2)
go to x: (67) y: (0)
switch backdrop to [Night City with Street]

forever
  change [Y Speed] by (-1)
  change y by (Y Speed)
  if then
    set [Y Speed] to (0)
    set [Jumps] to (2)
  end
end

This handles gravity and resets jumps when touching the ground.

4. Movement and Respawn

Add horizontal movement and edge handling:

forever
  if then
    change x by (5)
  end
  if then
    set [Y Speed] to (0)
    go to x: (-167) y: (0)
  end
end

5. Double Jump Logic

Allow jumping up to two times:

when [space] key pressed
if <(Jumps) > 0> then
  change [Jumps] by (-1)
  set [Y Speed] to (15)
end

6. Animation

Make the rabbit appear to run:

when green flag clicked
forever
  switch costume to [Rabbit A]
  wait (0.5) seconds
  switch costume to [Rabbit B]
  wait (0.5) seconds
end

7. Obstacles

Make trees and rocks move across the screen:

when green flag clicked
hide
wait (2) seconds
show
forever
  go to x: (240) y: (3)
  glide (4) secs to x: (-240) y: (93)
end

8. Collision Detection & Game Over

Detect hits and end the game:

forever
  if or then
    switch backdrop to [You Lose]
    stop [all v]
  end
end

9. Scoring & Win Condition

Add scoring and winning:

when green flag clicked
set [Points] to (0)

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

10. Sound & Feedback

Add audio for game states:

when backdrop switches to [You Lose]
play sound [Connect] until done

when backdrop switches to [You Win]
play sound [Dance Celebrate] until done

Game Enhancements

Here are 7 ways to enhance your double jump game:

1. Health System (Lives Instead of 1-Hit Death)

Add multiple lives for more forgiving gameplay:

when green flag clicked
set [Lives v] to (3)

forever
  if < or > and <(Shield) = [false]> then
    change [Lives v] by (-1)
    wait (0.5) seconds
    if <(Lives) = [0]> then
      switch backdrop to [You Lose v]
      stop [all v]
    end
  end
end

2. Variable Game Speed / Difficulty Increase

Make the game harder over time:

when green flag clicked
set [Speed v] to (4)

forever
  if <(Points) mod 5 = 0> then
    change [Speed v] by (1)
    wait (1) seconds
  end
end

3. Power-Ups (Shield, Extra Jump, Speed Boost)

Add collectible power-ups:

when green flag clicked
set [Shield v] to [false]

forever
  go to x: (240) y: (random -50 to 50)
  glide (4) secs to x: (-240) y: (random -50 to 50)
end

when this sprite clicked
set [Shield v] to [true]
wait (5) seconds
set [Shield v] to [false]

4. Parallax Background Effect

Create depth with moving backgrounds:

when green flag clicked
go to x: (0) y: (0)

forever
  change x by (-1)
  if then
    set x to (480)
  end
end

5. Jump Indicator

Show remaining jumps visually:

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

6. Start / Restart Game Button

Add a restart button:

when this sprite clicked
broadcast [Restart v]

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]

7. High Score Tracker

Track the best score:

when backdrop switches to [You Win v] or [You Lose v]
if <(Points) > (High Score)> then
  set [High Score v] to (Points)
end

Conclusion

Congratulations! You've created a fully functional double jump platformer game in Scratch. This project demonstrates advanced concepts like physics simulation, collision detection, and state management. Keep experimenting with different mechanics and share your creations with the Scratch community!

Remember to save your project and try out the enhancements to make your game even more engaging. Happy coding!

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!

Next Steps: 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!