UnicMinds

Coding Flappy Bird Game in Scratch

Coding the Flappy Bird Game in Scratch

Flappy Bird is an iconic game. The player should make the bird fly as far as possible.

How to play the Flappy Bird Game?

The player controls the bird using the space key. Every time the player presses the space key, the bird flaps its wings and flies. The bird needs to cross the pipes as it flies across. Every time the bird crosses the pipes, the player gets a score. If the bird touches any of the pipes, it’s game over.

Steps to create the Flappy Bird Game

Step 1: Create the background

Click on choose a backdrop option at the bottom right corner and then choose the blue sky backdrop.

Coding Flappy Bird Game in Scratch Programming
Flappy Bird game

Step 2: Create the parrot and the pipes.

Click on choose a sprite option and choose a parrot as shown below.

Change the size of the parrot to 25.

For the pipe , click on the upload sprite option and select the pipe saved on your computer.

Change the size of the pipe to 150.

Flappy Bird Scratch Game
Flappy Bird Scratch Game Background

Upload the pipe sprite

Flappy Bird Game for Kids

Step 3: Write code for pipe looping in the game

Flappy Bird Game Code for kids

When Flag is  clicked, the pipe will create a clone of itself every 2 seconds in a forever loop which means that the pipes will keep forming till the game is over.

Step 4: The pipe will move from left to right when the clone is formed

Flappy Bird Game in Scratch

When the copy of the pipe is created, the pipe will be created at the x value of 240 and y value between -80 and 80.  Then it will move from right to left every 4 seconds to the place where the x position is -240 and y position will be the previous position of the pipe.

Step 5: Make the parrot flap its wings when the space key is pressed.

Flappy Bird Game in Scratch

When the flag is clicked, the bird should go to its original position. Then the y position is decreased by 3 pixels, which means the bird will move down.

Flappy Bird Game for Kids

When the space key is pressed, the y position is increased by 6 which makes the bird move up. At that time , the costume of the bird should be wings down. Then after that the costume changes to wings up and the bird starts moving up. Remember the bird is constantly moving down in a loop. When the space key is pressed, the bird starts moving up which makes the bird appear to flap its wings.

Step 6: Score points in the game

Flappy Bird Game in Scratch

Create  a variable score and set the value to 0 initially.

Flappy Bird Game

When the pipe starts as a clone, we need to check if the x position of the bird is more than the x position of any pipe which means that the bird has crossed the pipe and the point is scored. 

Step 7: Game over code for bird

Flappy Bird Game in Scratch Programming

When the bird touches the pipe or touches any edge of the screen , a game over message is broadcasted. Every other sprite should stop moving which means the pipe stops looping.

Step 8: Game over code for pipe

flappy bird game in scratch

When the pipe receives the message, it will be game over.

Hope this is useful to provide you an idea on how to code this Flappy Bird game. Now, try creating the game on your own. 

You may like to read: 10 Games to Code in Scratch, Math Tuitions for Kids, and NWEA MAP Test for Kids

BOOK A FREE TRIAL