How to make a Geometry Dash game in Scratch - create and learn (2023)


Geometry Dash is extremely exciting to play! So today we are going to share how to make a Geometry Dash game in Scratch. In Geometry Dash, players control a character's movement and navigate by avoiding obstacles such as spikes or colliding with blocks that instantly destroy the character. At the end of our article, you will create your own Geometry Dash gameKraskodering.

To create even more fun games, join our award-winning, expert-led live online Scratch courses (Ninja Krasfor groups 2-5 andAccelerated scratchfor grades 5-9), designed by professionals from Google, Stanford, and MIT. If you try ours, there is no riskfree introductory Scratch course for kids.

You can also enjoy creating Pokémon games and customizing them in various creative ways on our live webPokemon Game Making Tutorials:

What is Geometry Dash in Scratch?

Geometry Dash game is a 2D game where you have to overcome geometric obstacles in different levels to complete them.

Geometry Dash is quite easy to play. The game can be played using a touch screen, keyboard, mouse or controller depending on the platform.

The objective of the game is to complete the level by reaching its end. Press space to make the player jump and avoid obstacles. If the player collides with an obstacle, the game will restart.

Learn how to code Geometry Dash in Scratch

Usually Geometry Dash game has many levels. But today, for the sake of simplicity, we will not add layers. Let's start! I'm going to youMIT Scratch website and log in.

1. Choose or draw a background

The first thing we need to do is create a background as it is empty by default. To choose/design your own wallpaper, click on the circular mountain icon on the right side of the screen, which will allow you to choose a wallpaper.

How to make a Geometry Dash game in Scratch - create and learn (1)

Go ahead, choose a wallpaper. Or if you want to draw your own background, click on the brush.

Here we have drawn two backgrounds. One is a solid color background with a yellow stroke. The second is about the Game Over situation.

How to make a Geometry Dash game in Scratch - create and learn (2)
How to make a Geometry Dash game in Scratch - create and learn (3)

2. Draw your sprite

Now that you have the backgrounds ready, we need to design our sprites. The round blue cat icon in the lower right corner allows you to draw a new elf. Go ahead and select the brush option to draw the sprites.

How to make a Geometry Dash game in Scratch - create and learn (4)

In this game, we draw 2 elves.

  • The first sprite is a square player. You can use your creativity and design your own player.
How to make a Geometry Dash game in Scratch - create and learn (5)
  • The second sprite consists of triangular vertices/obstacles.
How to make a Geometry Dash game in Scratch - create and learn (6)

Draw 3-4 pin suits as shown in the image above.

3. Create a variable to score

Go to Variable Blocks and create a variable called score where you will store the scores.

4. Place the player and make him jump

Now that we have everything ready, let's start coding! At the beginning, we will save the player's position (sprite). And then when we press the spacebar, the player has to jump to avoid the spikes.

Choose a player sprite and let's start our code withWhen the flag was pressed blockfrom the Event blocks and then derive the Show block from the Look blocks. Catch it belowHead to 90 blocks andgo to block x:-152 and y:-104traffic blocks.

To make the player jump every time you press the spacebar, add oneblock foreverand put it foreverIF blockcontrol block. Inside the IF condition putblock spacebarsensory blocks.

Put two in an IF blockRepeat 10 blocksone by one with control blocks. In the first repeating block, placerotate the block 10 degrees to the rightIchange y by 10 blocktraffic blocks. In the second block of repetitions, addrotate the block 10 degrees to the rightWchange y by -10 blocktraffic blocks.

Add one after repeating blocksindicate the 90 direction blocktraffic blocks.

How to make a Geometry Dash game in Scratch - create and learn (7)

5. Reset your score and start conquering many peaks

To start scoring, we need to set the score variable to 0 and spawn sprite Spikes every second.

To do this, click on the Spike sprite and run the code stack with the buttonWhen the flag was pressedevent block block. Then addset scoreup to 0 variable block blocks. Add one belowhide blocksfrom a Look block to hide the original sprite.

Add nowBlock forever.Add Inside forevermake a block cloneWwait 1 second blockcontrol block.

How to make a Geometry Dash game in Scratch - create and learn (8)

6. Move the pins along the path

To move vertices in a piece, start your code withIf I start as a cloneblock by control block and add oneShow blocksfrom Look blocks. Add belowgo to block x:170 y:-108motion block to determine the initial position of the spikes. Now addchange suits to suit 1 blockfrom Look blocks. Replace suit 1 with onechoose random blocks from 1 to 3from operator block. To make our spikes move from end to end, we'll addmove 1 second to position block x:-280 y:ytraffic blocks.

Once the clone sprite reaches its specified position, it should disappear. Add to remove clonesremove the clone blockcontrol block at the end of the stack.

How to make a Geometry Dash game in Scratch - create and learn (9)

7. Earn points

Once the game starts, players start earning points. The player gets points until the player touches the studs.

So for our code we start the stack withClicking on the flag meant clicking on the blockfrom event blocks. Add one belowBlock foreverWRepeat to blockcontrol block. In the repetition condition we add aTouching a player's blocksensory blocks.

Within loop to block, just add onechange the result by 1 blockfrom variable blocks.

How to make a Geometry Dash game in Scratch - create and learn (10)

8. When the player touches the studs, the game is over

The game ends once the player touches the points. But for that we need to change the background and stop all scripts.

Click the player icon and start generating the code stack withClicking on the flag meant clicking on the blockfrom event blocks. One add oneforever en If blockcontrol block. Inside the if add conditionblocks by touching spikessensory blocks.

If so, please addchange background to background2/block gamefrom Look and a blocksstop all blockscontrol block.

How to make a Geometry Dash game in Scratch - create and learn (11)

9. Hide the sprite when the game is over

When the game ends, we need to hide our player sprite. For this, we need to initialize our stack withWhen background go to background block 2from event blocks. Add one belowhide blocksfrom Look and a blocksplay the sound ____ until the end of the blocksound block.

How to make a Geometry Dash game in Scratch - create and learn (12)

10. Fun bonus tasks

The Geometry Dash game we created here is very simple. All in all, these games are endless games with countless levels to play. To make your game more interesting, you can add:

  • Different levels
  • Timed power amplifiers
  • More upgrades based on score
  • Different types of obstacles
  • Increase the peak/obstacle playback rate
  • Different backgrounds of the world

Create a geometry puzzle game in Scratch

Now you have created a fun geometry throwing game from scratch! Play your game and see how far you can go. In this tutorial, you learned how to use basic bricks to create amazing things. You can create so much in Scratch! Then see how you can do itcreate a click game in Scratch.

Check out our award winning games to keep making great gamesScratch Coding in Kids Lessonsand oursGame making class- all hosted live by an expert and designed by professionals from Google, Stanford and MIT. It's completely risk-free to try our free introductory session!

ScenarioApoorva Rastogi, a Create & Learn instructor who has been working as a coding instructor for over 6 years. Apoorva holds a bachelor's degree in mathematics and a master's degree in computer applications.

References

Top Articles
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated: 09/10/2023

Views: 6693

Rating: 4.1 / 5 (52 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.