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.
Choose blue sky 2 backdrop as shown below
It will create the backdrop as shown below. Delete the cat sprite once the backdrop appears.
Click on backdrops on the top left corner in the image above. It will show the following:
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.
Click on the paint option under create backdrop icon as shown below to create the second backdrop for the game.
It will create an empty backdrop as shown below.
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.
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.
Click on costumes on the top left corner.
Click on the square and use different options to create your own version of the sprite with eyes and mouth as shown below.
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.
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:
Creating different spikes is the next step. Right click on the uploaded sprite and choose duplicate as shown below.
Click on the select option as highlighted in red in the image below
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.
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.
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.
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.
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.
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.
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