How To Make Flappy Bird Game
How To Make Flappy Bird Game
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 our 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 they enjoy this type of project, and
how much they learn along the way!
In this tutorial, I will teach you how to create a Flappy Bird Game in Scratch. In doing so,
you will learn about animating sprites across the screen, creating a score system, and checking
for collisions between two sprites. Let’s get started!
Make a Flappy Bird Game
Set a mood with the right song or use sound effects to enhance your game using these simple
steps.
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.
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.
● 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 the 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.
● 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.
1. Create a variable
In your Flappy Bird Project, go to the Variables category and right-click on the variable
called my variable, which is 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
In our inaugural course, "Animation and Games with Scratch," young learners delve into
crucial programming concepts such as variables, loops, and conditionals. Upon
completing this course, they will possess the proficiency to craft their own games and
animations through Scratch, thus equipping them for more advanced coding endeavors
and a promising future in the realm of technology. Our program fosters the development
of children's skills and imagination, all while ensuring an enjoyable and educational
experience.