0% found this document useful (0 votes)
746 views35 pages

How To Make Flappy Bird Game

This document provides instructions for creating a Flappy Bird game in Scratch. It explains how to set up the game environment including choosing a backdrop and sprites. It then guides the reader through coding the bird sprite to fall and fly up, animating an obstacle sprite, adding a collision detection system to end the game, and bonuses for adding a score counter and animating the bird's wings. The goal is to teach programming concepts like variables, loops, and conditionals while making an interactive game.

Uploaded by

gauravjeet singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
746 views35 pages

How To Make Flappy Bird Game

This document provides instructions for creating a Flappy Bird game in Scratch. It explains how to set up the game environment including choosing a backdrop and sprites. It then guides the reader through coding the bird sprite to fall and fly up, animating an obstacle sprite, adding a collision detection system to end the game, and bonuses for adding a score counter and animating the bird's wings. The goal is to teach programming concepts like variables, loops, and conditionals while making an interactive game.

Uploaded by

gauravjeet singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

How to Make Flappy Bird on Scratch

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.

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 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.

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, 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

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. Check Out Your Game


● Do your Parrot’s wings flap?

More Scratch Tutorials & Games


Check out these other fun Scratch articles!
● 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 adn 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 during
a student’s formative years can pave the way for future success. Our specialized
program tailored for elementary school children utilizes Scratch as a foundational tool
for imparting coding skills.

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.

You might also like