Home> Blog>  How to Make Flappy Bird in Scratch (Step-by-Step with Code)

How to Make Flappy Bird in Scratch (Step-by-Step with Code)

how to make a flappy bird in scratch

Flappy Bird is one of the most addictive games ever made. The good news? You can build your own version using Scratch! Whether you're just getting started or want to add a cool project to your Scratch portfolio, this guide will walk you through how to make Flappy Bird in Scratch step by step — including the exact code you need.

By the end, you’ll have your very own flying bird game, complete with pipes, gravity, and that sweet high-score challenge.


What You’ll Need

Before we begin, make sure you have:

  • A Scratch account (it's free at scratch.mit.edu)

  • A basic understanding of sprites and scripts

  • A few minutes and some creative energy


Step 1: Set Up Your Flappy Bird Sprites

Create or Import Sprites

  • Bird Sprite: You can draw a simple bird or choose one from Scratch’s library.

  • Pipe Sprite: Create a vertical rectangle. You’ll duplicate it later.

  • Background: Choose a simple sky backdrop or draw your own.


Step 2: Add Bird Movement with Gravity

Here’s the core code for your bird sprite to flap and fall:

when green flag clicked
set y to 0
set gravity to -2
forever
    change y by gravity
    if <key [space v] pressed> then
        change y by 15
    end
end

This script makes the bird fall and flap when the space key is pressed — just like in the real game.


Step 3: Create Scrolling Pipes

You’ll want two identical pipes scrolling from right to left.

when green flag clicked
forever
    change x by -3
    if x < -240 then
        set x to 240
        set y to pick random -100 to 100
    end
end

Duplicate this pipe so there are both top and bottom obstacles with a gap between them.


Step 4: Detect Collisions and End the Game

Use this code on the bird sprite to detect if it hits a pipe or touches the edge:

forever
    if <touching [Pipe v]> or <y position > 180> or <y position < -180> then
        stop all
    end
end

This stops the game when the bird crashes into something or flies too high or low.


Step 5: Add Score

Create a variable called score and update it when the bird passes a pipe:

when green flag clicked
set score to 0
forever
    if <x position of Pipe = -50> then
        change score by 1
    end
end

This adds 1 point every time the bird successfully flies past a pipe.


Bonus: Add Sounds and Polish

  • Add a jump sound when the bird flaps

  • Use "Game Over" broadcast to show a restart screen

  • Add a high score tracker using a cloud variable (if logged in)


Recap: What You Just Built

You now know how to make a Flappy Bird in Scratch, complete with:

  • Gravity physics

  • Scrolling pipes

  • Collision detection

  • Scoring system

This is a perfect beginner project to show off your game development skills!


Want Help? Get a Tutree Coding Tutor

Need extra help or want to build more games like this? Tutree connects you with expert coding tutors who love working with kids.

Click here to get a Scratch tutor and start building better games today


Now that you’ve learned how to make Flappy Bird in Scratch step by step, try remixing it with your own ideas and make it even cooler. Happy coding!