Skip to content

Flappy Bird Clone with Scratch

Create your own Flappy Bird-style game using Raspberry Pi and Scratch with a parrot flying through pipes.

  • Raspberry Pi
  • Beginner
  • 45 minutes
  • 6 steps

Shop this project

Cart

You'll need

Prices from vilros.com. Tax and shipping at checkout.

Before you start, you'll need

  • Raspberry Pi (any model)
  • Keyboard
  • Mouse
  • Monitor

Start Scratch and set backdrop

About 5 minutes

Create a new Scratch project.

  1. Open Scratch 3 from the Programming menu.
  2. Delete the default cat sprite.
  3. Choose a backdrop: Blue Sky or similar.
  4. Save your project as 'Flappy Bird'.

You should see

Scratch is open with a sky backdrop.

Design the pipe obstacles

About 10 minutes

Create a pipe sprite with a gap.

  1. Create a new sprite called 'Pipes'.
  2. Use the paint editor to draw two rectangles (top and bottom) with a gap in the middle.
  3. Make the gap about 100-150 pixels high.
  4. Add shading or color to make pipes look 3D.
  5. Position pipes off the right edge of the screen.

You should see

Pipe sprite is created with a gap for the bird to fly through.

Make pipes move and clone

About 10 minutes

Pipes glide across screen and repeat.

  1. Add code: when green flag clicked, forever loop.
  2. Create clone of pipe sprite.
  3. Glide the clone from right to left in 2-3 seconds.
  4. Delete clone when it reaches the left edge.
  5. Randomize the Y position of each clone for variety.
  6. Wait 2 seconds between clones.

You should see

Pipes continuously move across the screen.

Add the player bird

About 10 minutes

Create a bird sprite that falls.

  1. Choose a parrot or bird sprite (or use 'Parrot' from library).
  2. Rename it 'Flappy'.
  3. Position at X: -50, Y: 0.
  4. Shrink to 25% size.
  5. Add two costumes: wings up and wings down.
  6. Code: when flag clicked, forever, change Y by -2 (gravity).

You should see

Bird sprite falls downward continuously.

Program flapping

About 5 minutes

Make bird jump when spacebar is pressed.

  1. Add code: when space key pressed.
  2. Change Y by 20 (jump up).
  3. Switch between wing costumes rapidly.
  4. Play a flapping sound (optional).

You should see

Pressing space makes the bird jump upward.

Add collision and scoring

About 5 minutes

Detect crashes and track score.

  1. Add code: if touching Pipes, broadcast 'GameOver' and stop all.
  2. Display 'GAME OVER' text on screen.
  3. Track score: when bird passes a pipe (X coordinate crosses pipe), add 1 point.
  4. Display score with a variable.
  5. Play sound effects for passing pipes and crashing.

You should see

Game ends when bird hits a pipe. Score increases when passing pipes.

It didn't work
  • Bird falls too fast or jumps too high.

    Adjust the gravity value (change Y by -2) and jump height (change Y by 20) to balance gameplay.

What to do next

Stuck? Contact Vilros Support with your board model and what you see on screen.