UnicMinds

Coding Geometry Dash Game in Scratch Programming

Geometry Dash Game in Scratch Programming

This is a 2D game in which a cube shaped character moves sideways and goes through various obstacles of spikes at different heights and different levels. 

Step 1: Create backdrops for the Geometric Dash Game

To choose/design your own backdrop, click on the icon on the right side of the screen to choose your backdrop.

Choosing Backdrop in Scratch

Choose blue sky 2 backdrop as shown below 

Choosing Backdrop Theme

It will create the backdrop as shown below. Delete the cat sprite once the backdrop appears.

Preparing Geometry Dash Program

Click on backdrops on the top left corner in the image above. It will show the following:

Geometry Dash - Backdrop

Click on the rectangle and draw a rectangle at the bottom of the backdrop. You can fill the rectangle with any color of your choice using the fill option.

Geometry Dash Program - UnicMinds

Click on the paint option under create backdrop icon as shown below to create the second backdrop for the game.

Coding the Geometry Dash Program

It will create an empty backdrop as shown below.

Geometry Dash Backdrop - UnicMinds

Click on the T (text option) to write the Game over text on the backdrop. You can adjust the size and font as per your choice.

Geometry Dash Backdrops - UnicMinds

Step 2: Create Sprites for the Geometric Dash Game

The first sprite is the player which is a square shaped sprite. 

Click on the  blue color cat icon on the right bottom corner to draw a new sprite. Select the paintbrush option to draw your sprites.

Geometry Dash - Paintbrush

Click on costumes on the top left corner.

Geometry Dash - Costumes

Click on the square and use different options to create your own version of the sprite with eyes and mouth as shown below.

Geometry Dash - Sprites - UnicMinds - Square Block

The second sprite is the spike in the game. Download any picture of the spike from the internet. Don’t forget to remove the background of the downloaded image before using it in the game. Once you have downloaded the image.

Click on the upload option under the create sprite icon and choose the downloaded image.

Programming Geometry Dash
Geometry Dash - Triangle

Change the size of the sprite as per your choice and drag it and place it on the top of the rectangle as shown below:

Geometry Dash - Base - UnicMinds

Creating different spikes is the next step. Right click on the uploaded sprite and choose duplicate as shown below.

Geometry Dash Triangle

Click on the select option as highlighted in red in the image below

Designing Geometry Dash Triangle Obstacle

Click on the copy and paste option to create duplicates of the image. You can adjust the position by dragging the duplicated images to create multiple spikes as shown below. Change the size after creating the new spikes as per your choice.

Geometry Dash Triangle Obstacles - UnicMinds
Geometry Dash Triangles

Step 3: Making the player jump when Space key is pressed

The code below makes the player jump in an angle when the space key is pressed.

Making the player jump in Geometry Dash - UnicMinds

Step 4: Making multiple spikes and moving them 

Click on the spike sprite and add the following code blocks.

When the game starts, the spike creates its own clone repeatedly every 3 seconds. One can adjust the frequency of spikes in the game by changing the seconds. The more the number of seconds, the lesser is the frequency of spikes appearing in the game.

Making multiple spikes and moving the spikes in Geometry Dash - UnicMinds

Whenever a clone of the spike is created , the clone goes to the starting position of x :200 and y: -83. One can change the starting position as per the game design.

The spike is chosen randomly. As there are four types of spikes, the computer will randomly choose the spike based on the random number between 1 to 4. Then the created clone moves from left to right with y position fixed. Then the clone is deleted once its out of the screen.

Geometry Dash - Cloning - UnicMinds

Step 5: Score points 

As soon as the game starts, players will start scoring points. The player will get points until the player touches the spikes.

Add the code below for the spike sprite. The score keeps adding by 1 every 2 seconds till the spike touches the player. Once can change the number of seconds to adjust the speed with which the player can score points. 

Geometry Dash Program for Kids - UnicMinds

Step 6: When the player touches the spikes and the game ends

Add the code below for the player sprite. It checks whether the player has touched any of the spikes repeatedly. 

Whenever the player touches the sprite, the spikes stop moving , score will stop changing and all the loops stop running. The game over backdrop appears showing the game has ended. 

When the game ends we need to hide our player sprite.

Kids can code Geometry Dash in Scratch

Hope this is useful, thank you.

You may like to read: C Programming for Kids, Educational Games for 6 Year Olds, & 11 Plus Grammar Schools in the United Kingdom

Leave a Comment

Your email address will not be published. Required fields are marked *

BOOK A FREE TRIAL