Today youre going to find out how to make a Flappy Bird in Scratch! Well show you how to control the bird with the space key, build moving pillars, and update the score every time the bird flies through them. Keep reading to see how to build your game.
If you enjoy creating games, be sure to check out our award-winning live online Scratch coding for kids classes and our intermediate game building class for kids.
Check out upcoming free computer science events for kids led by tech experts: past events have featured guests from Pixar, NASA, Intel, and more.
Step 4: Make a background [end of the game]
Lets make a background for the end of the game.
- Click on the sprites Paint.
- Click on the Convert to Bitmap
- Click on the Fill and select the black color.
- Click on the Fill tool.
- Click on the paint area.
- Click on the Convert to Vector
- Click on the Text tool
- Click on the Fill and select the red color.
- To select the paint area, click the “Text” tool.
- Write a note saying “Game Over” when the game ends.
- Change the sprite name.
- Modify the sprite’s location and set (x, y) = (0, 0).
- Click on the Code
- Hide the game over sprite when the game start.
- Drag
- Let’s add a message receive block so that the “game over” sprite appears on the game over message.
- Drag
- Type the message for the end of the game.
- Click on Ok
- The “game over” sprite will appear and the flappy bird game will end when you drag and drop the “When I receive the game over” message.
- Drag
- Click on the bird sprite.
- End the game if the bird touches the pipe sprite.
- To determine whether the bird touches the pipe sprite, write a conditional statement.
- Drag
- Lets broadcast a game-over message.
- Drag
How to make a Flappy bird game on Scratch in 9 minutes?
The following describes the comprehensive, step-by-step procedure for creating a Flappy Bird game using Scratch:
Step 1: Make a Flappy motion sprite [bird]
Below are the comprehensive instructions for making a flappy bird game using Scratch;
Making the object move is the first step in making the Flappy Bird game on Scratch. To do that, we must select the appropriate sprite. The specific instructions for doing so are provided below:
- Delete the Cat sprite
- Click on the delete icon.
- Lets make a backdrop, click on Backdrops
- Click on the Convert to Bitmap
- Click on the fill from the paint tool.
- Click on Fill and select the color.
- By dragging the “Color,” “Saturation,” and “Brightness” sliders as indicated below, you can choose the color.
- Click on the paint area.
- Click on the Code
- Pick a character for the game. Lets add a bird sprite.
- Click here to download the bird sprite.
- Click on the Download.
- Bird sprite () downloaded.
- Click to open the saved folder of bird sprite.
- Click on the Show in folder
- The “Downloads” directory contains your saved sprite; it might look different for you.
- Now, upload the sprite to the game.
- Click on the Upload Sprite
- Go to your downloads directory, find the bird sprite, and click on it.
- Then click on Open
- The bird sprite was added to the game. To ensure that the bird is small enough to fly through the pillars, adjust the size of the bird sprite.
- Change the size to 50
- Make the bird the flappy motion. You can move the sprite upward in Scratch.
- Drag
- Click on it as shown below. The bird can move upwards.
- Establish a variable to record the bird’s Y position. And we will call it gravity.
- Click on Variables and click on Make a Variable.
- Name your variable
- Click on the Ok
- Drag
- Drag the “gravity” variable from the “Variables” menu.
- Make the bird fall down. So change the value of gravity.
- Drag
- Drag & drop a forever loop as shown below.
- Set the birds position when the game starts.
- Drag
- Click on the green flag.
- The bird is falling down.
- The space bar controls the flappy motion; each time you press it, the bird rises. The Sensing block “when space key pressed” is what we want to be the condition for the if statement.
- Drag
- We want the bird to go up. Change the gravity variable value to a positive number.
- Drag
- To repeatedly verify this condition, drag
- Drag
- Click on the green flag.
- Pressing the space bar key causes the bird to ascend.
- However, if you continue to press the space bar, the bird will continue to rise and cross the scratch stage area.
- Add a conditional statement to avoid this.
- Construct a conditional statement to determine if the “space key” is being pressed or not.
- Drag & drop the wait until block as shown below.
- Drag
- Drag
- Click on the green flag.
- The bird won’t overshoot the scratch stage if you keep hitting the “Space key.”
FAQ
What is the trick to Flappy Bird?
Why did Flappy Bird get banned?