Skip to content
Email jcinfo@juniorcoderz.com
Junior Coderz logo

Scratch

How to Make Geometry Dash on Scratch (Scratch Geometry Dash Tutorial)

  • Junior Coderz Team
  • 7 min read
How to Make Geometry Dash on Scratch (Scratch Geometry Dash Tutorial): Junior Coderz blog cover

Jump, flip, dodge the spikes, and try again. And again. Fast rhythm games like Geometry Dash are some of the most played games on Scratch, and building one yourself is even more fun than playing. In this tutorial, you will learn how to make Geometry Dash on Scratch: a cube that jumps and spins, spikes that slide towards you, a crash-and-retry system, an attempts counter and music.

Scratch, the free coding platform made at MIT, has everything you need. If you know the basics, you can build your own Scratch Geometry Dash-style game in about an hour.

How a Geometry Dash-Style Game Works

The trick behind this kind of game is that the player doesn't really move forwards. The cube stays in the same place on the left of the screen and only jumps up and down. Instead, the spikes and obstacles slide in from the right, which makes it look like the cube is racing through a level. Gravity pulls the cube down after each jump, and touching a spike means a crash.

PartWhat it doesScratch idea used
Cube (player)Jumps, falls and spinsVariables for gravity, rotation
SpikesSlide in from the rightClones, motion
GroundWhere the cube landsA y position check
Attempts counterCounts every crashVariables, broadcasts

How to Make Geometry Dash on Scratch, Step by Step

Open Scratch, click Create and follow these steps. All the code is written below each step, so you can find the matching blocks.

Step 1: Make the Sprites and Backdrop

Delete the cat sprite and paint these:

  • Cube: a bright square, about 40 by 40 pixels, with a simple face or pattern. Make sure it is centred in the paint editor, so it spins neatly.
  • Spike: a triangle about 40 pixels wide and 40 pixels tall.
  • Backdrop: a dark, colourful background with a ground line near the bottom, at about y = -140.

Use your own design and colours. That makes the game truly yours.

Step 2: Create the Variables

Make three variables, all "For all sprites": y speed (how fast the cube moves up or down), attempts (the number of tries) and score (how many spikes you have passed). Untick y speed so it doesn't show on the stage.

Book a Free Trial Class

Step 3: Make the Cube Jump With Gravity

Click the Cube sprite and add this script. Each time round the loop, gravity makes the y speed a little smaller, so the cube slows down, stops and falls back, just like a real jump.

when green flag clicked
set attempts to 1
set score to 0
go to x: -150 y: -120
point in direction 90
set y speed to 0
forever
    change y speed by -2
    change y by (y speed)
    if <(y position) < -120> then
        set y to -120
        set y speed to 0
    end
    if <<key [space] pressed?> and <(y position) = -120>> then
        set y speed to 18
    end
end

Press Space to jump. The "y position = -120" check means the cube can only jump from the ground, so players can't fly. If your ground line is in a different place, change -120 to match.

Step 4: Make the Cube Spin in the Air

A spinning cube is what makes this style of game look so cool. Inside the forever loop, add this after the jump check:

if <(y position) > -120> then
    turn right 10 degrees
else
    point in direction 90
end

With a jump speed of 18 and gravity of 2, the cube stays in the air for about 18 frames, so turning 10 degrees each frame gives a perfect half-flip on every jump.

Step 5: Send in the Spikes

Click the Spike sprite and add these scripts. The main sprite stays hidden and keeps making clones, and each clone slides across the screen.

when green flag clicked
hide
forever
    create clone of [myself]
    wait (pick random 0.8 to 2) seconds
end

when I start as a clone
go to x: 260 y: -120
show
repeat until <(x position) < -240>
    change x by -8
end
change score by 1
delete this clone

The random wait means the gaps between spikes change, so every run feels different. If a spike looks like it is floating or sinking, adjust its y number to sit on your ground line.

Step 6: Crash and Try Again

Back in the Cube sprite, add this check inside the forever loop:

if <touching [Spike]?> then
    start sound [Crash]
    change attempts by 1
    set score to 0
    broadcast [restart] and wait
end

Then add this script to the Spike sprite, so all the old spikes vanish when you crash:

when I receive [restart]
delete this clone

Now each crash clears the screen, adds one to the attempts counter and starts a fresh run, just like the real thing. Add a crash sound from the Sounds tab first.

Step 7: Add Music

Music is a huge part of rhythm games. Click the Stage, open the Sounds tab and choose a loop from the Loops category, such as "Dance Around" or "Techno". Then add:

when green flag clicked
forever
    play sound [Techno] until done
end

Your Geometry Dash-style game is ready to play! For more on game music, see our guide to music in Scratch games.

Ways to Level Up Your Scratch Geometry Dash

  • Speed up: make a speed variable that grows as the score goes up, and use it in "change x by" for the spikes.
  • Blocks to jump on: add square platforms the cube can land on, using "touching color" checks to stop the fall.
  • Jump pads: a yellow pad that sets y speed to 25 for a super jump.
  • A designed level: instead of random spikes, use a list of wait times so every run follows the same level layout.
  • Progress bar: a bar at the top that grows as the player gets closer to the end.
  • Particle trail: small fading clones behind the cube.
  • Practice mode: checkpoints that save where you were.

Want the background to move too? Learn how in our guide to making a scrolling background in Scratch. For a different jump-and-dodge challenge, try our Flappy Bird in Scratch or Scratch platformer tutorials.

Fixing Common Problems

ProblemFix
The cube falls through the floorCheck the ground number (-120) is the same in every block
The cube can jump in mid-airKeep the "y position = -120" check in the jump block
The cube spins off-centreCentre the costume in the paint editor
Crashes happen before touching a spikeMake the spike costume a little smaller, or trim empty space around it
Spikes keep coming after a crashAdd "when I receive restart, delete this clone" to the Spike sprite

What Kids Learn by Making This Game

This one game covers some big coding ideas: variables for gravity and score, loops, if-statements, clones, broadcasts and random numbers. Kids also learn a little physics, because the y speed and gravity work the same way as real falling objects. Most importantly, they learn game design: how small changes to speed, jump height and spacing make a game feel easy, fair or impossibly hard. Looking for your next game? Browse our Scratch game ideas.

Build Faster, Better Games With Junior Coderz

At Junior Coderz, children learn Scratch in live online classes with engineer instructors, building games like platformers, runners and puzzles while learning gravity, clones and game design. Our Scratch classes for kids take beginners step by step to complete games, and our game development classes help older students go further. See every option on our courses page.

Turn Your Child's Favourite Game Into a Coding Project

If your child loves fast games, they will love building them. In a free trial class, one of our engineer instructors guides them through a live game project, explaining every block and helping them fix bugs. You also get honest advice on the right level and next steps.

  • Build Real Games
  • Engineer Instructors
  • Ages 6 to 16

Book a Free Trial Class

One More Attempt

You have built a fast, spinning, spike-dodging game with your own code. Now make it yours: design harder levels, add jump pads, choose your music and share it on Scratch so friends can see how many attempts they need. Every great game designer started exactly like this, with one jump and one spike. To see what other young game makers are creating, visit Junior Coderz or follow us on Instagram.

FAQs

Is Geometry Dash on Scratch the real game?

No. The Geometry Dash games on Scratch are fan-made projects inspired by the original. You can build your own version with your own designs, like in this tutorial.

How do you make the cube jump in Scratch?

Use a y speed variable. Set it to a positive number when Space is pressed, then lower it a little every frame so gravity pulls the cube back down.

How do you make the cube spin while jumping?

While the cube is above the ground, turn it a few degrees every frame. When it lands, point it in direction 90 so it sits flat again.

How do you make obstacles move in Scratch?

Create clones of the spike sprite. Each clone starts on the right and moves left with "change x by" until it leaves the screen, then deletes itself.

How do you add an attempts counter?

Make an attempts variable, set it to 1 when the game starts and change it by 1 every time the cube touches a spike.

What age is this Scratch tutorial for?

It suits children from about 9 or 10 who know the Scratch basics. Younger children can follow along with help from an adult.

Turn Screen Time Into Creation Time

Book a free trial class and see how your child learns to code with Junior Coderz.

Book a Free Trial Class
All articles