Scratch is a great tool for kids to learn how to code, and it’s completely free! You can use Scratch to make fun games, stories, and animations by dragging and dropping different blocks of code. It’s really easy to use and perfect for beginners who want to be creative and solve problems with coding.
This type of project has proven to be highly interactive and fun in the Scratch classes I’ve taught here at CodeWizardsHQ. In the Elementary School Core Track, students have the opportunity to create their own interactive games while mastering important programming concepts such as variables, loops, and more.
It’s amazing to see how much kids enjoy this type of project and how much they learn along the way.
Play and remix the Flappy Bird game now.
What you need:
- Scratch account: Create a free Scratch account
No coding experience is necessary for this Scratch tutorial. Beginner-friendly for kids ages 8 and up. Give it a try!
How to Make Flappy Bird on Scratch
1. Login to Scratch
- Go to scratch.mit.edu and either login or sign up.
2. Create a New Project
- Once you are logged in, click the blue Create button at the top of the page.
3. Name Your New Project
- Give your project a name, for example, “Flappy Bird Game”.
- Then delete the Scratch cat by clicking the trash can icon next to the sprite.
4. Choose a Backdrop
- Select the Choose a Backdrop option at the bottom right-hand side of your screen.
- When the Choose a Backdrop screen opens up, select a background for your Flappy Bird game. In this tutorial, I chose “Jungle”, but you can choose whatever you’d like!
5. Choose a Sprite
- Then, go to the Choose a Sprite option, which is next to the “Choose a Backdrop” section.
- Select a sprite of your choosing. We selected the Parrot sprite, which is suggested if you want to create a flapping motion for the character.
6. Resize and position the sprite
- Resize your sprite by changing the Size textbox, we changed it to 50 in this tutorial.
- Then, click and drag the sprite to the left of the game, since the pipes will be moving from the right to the left.
7. Add the first code block
- Go to the Events category in the Code tab, then click and drag a when green flag clicked block into your code area.
8. Set the sprite’s starting position
- Go to the Motion category and drag a go to x and y block under your when green flag clicked block. This will make sure the player begins at the same place every time the game is loaded.
9. Add gravity to the game
- Then, in the Control category, drag a forever block and attach it under the go to x and y block.
- Go back up to the Motion category and get a change by y block, then drag it directly into the forever block.
- Change the value in the textbox of the change by y block to -15. Now when you press the green flag icon above your game, the bird will fall really fast!
10. Make gravity slower
- To fix the bird from falling so quickly, put a wait block from the Control category before the change y by block.
- Change the value in the textbox to about 0.1.
11. Make the bird fly up
- Now let’s make it so the player can interact with the game! Grab a when space key pressed block from the Events category and drag it into the code area.
- Go to the Motion category and get a change y by block and put it below the when space key pressed block. Now the player can make the bird fly up! NOTE: Check out the bonus after this tutorial which will show you have to make the bird’s wings flap as they fly.
12. Design the Game’s Obstacle
- Click on the paint option from the New Sprite button.
- Select a color of your choice from the Fill option, then select the square from the list of tools.
- Click and drag the square to create two tubes that will be obstacles for the game. Reposition and resize the pipes as needed.
13. Animate the Obstacle
- Click on the Code tab and drag a when green flag clicked block from the Events category into the code area. Attach a forever block from the Control category.
- Next, go the the Motion category and drag a set y to block, set x to block, and a glide to x and y block inside the forever block.
- In the set x to block, change the textbox to say 275. This makes it so the pipes will start on the right side of the screen!
- Update the glide block to glide for 2 seconds and change the x value to -275, so that it moves to the left of the screen.
- Then, in the Motion category, drag a y position block inside of the y value in the glide block.
14. Randomly Position the Obstacle
- Test your project, you’ll notice that the pipes stay at the same position every time they move toward the player.
- To fix this, go to the Operators category and grab a pick random block and drag it into the set y to block.
- Change its values to something like -65 and 65.
15. End the Game Upon Collision
- Nothing happens when the parrot collides with the pipe! Let’s get a when green flag clicked block from the Events category and a forever block from the Control category to set this up.
- From the Control category, get an if then block and put it inside the forever block.
- Then, go to the sensing category and get a touching mouse-pointer block. Drag that into the if then block.
- Click the mouse-pointer option to change it to Parrot instead
- Go to the Control category and get a stop all block and put that inside the if then block. This will stop the game when the Parrot and pipes collide!
16. Test your game!
- The game should stop when the bird collides with the pipes. Check out the completed project here.
Bonus 1 – Adds a points system
1. Create a variable
- In your Flappy Bird Project, go to the Variables category and right-click on the variable called my variable. It’s right below the Make a Variable button.
- Then, select the Rename Variable option.
2. Name the variable
- In the popup window, type score for the name, then click OK.
3. Then, click the checkbox next to the score variable. This makes the score show up in your game.
4. Update the score
- Then, in the Variables category, drag a set score to 0 block right under the when green flag clicked block.
- Also get a change score by 1 block and put it under the glide block.
5. Test the game!
- Test your game, you should be able to get a score now when you play the game
Bonus 2 – Make the bird’s wings move as you play the game
1. Select the Sprite
- First, make sure you click the Parrot sprite from the sprites list.
2. Switch the Sprite’s costume
- Go to the Looks category and grab a switch costume block for inside the forever block and under the when space key pressed block.
- Make sure that you are using parrot-a in the forever block and parrot-b under the when space key pressed block.
3. Test the Game
- Do your Parrot’s wings flap? Then, your project is complete, great job!
More Scratch Tutorials & Games
Now that you’ve built your Flappy Bird Game in Scratch, check out these other fun Scratch tutorials!
- Flying Space Cat – Assist Space Cat in its space exploration mission by developing an enjoyable crystal-collecting game using Scratch programming platform.
- Code a Rocket Landing Game – Finish this Scratch programming tutorial designed for children and create a game where you safely land a rocket.
- Valentines Day Card Scratcher – Create a Valentine’s Day scratch-off card with a personal touch by following this easy-to-follow Scratch programming tutorial.
- Holidays Advent Calendar – Use Scratch to program a customized Advent Calendar for the holiday season and gradually unveil presents, treats, or activities to share with your friends and family.
- Halloween Candy Collector Game – Follow this simple Scratch programming tutorial and create a personalized game where you collect candies on Halloween.
Try a Scratch Coding Class for Kids
At CodeWizardsHQ, we believe that learning about technology and programming at a young age can help you succeed in the future. Our coding program for kids in elementary school uses Scratch to teach them how to code.
In the first course, Animation and Games with Scratch, students learn important programming concepts like variables, loops, and conditionals. By the end of the course, they will be able to make their own games and animations using Scratch. This helps them get ready for more advanced coding and a future in technology.
Coding in Scratch lets kids learn a useful skill while having fun and discovering something new!