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
CartYou'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.
- Open Scratch 3 from the Programming menu.
- Delete the default cat sprite.
- Choose a backdrop: Blue Sky or similar.
- 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.
- Create a new sprite called 'Pipes'.
- Use the paint editor to draw two rectangles (top and bottom) with a gap in the middle.
- Make the gap about 100-150 pixels high.
- Add shading or color to make pipes look 3D.
- 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.
- Add code: when green flag clicked, forever loop.
- Create clone of pipe sprite.
- Glide the clone from right to left in 2-3 seconds.
- Delete clone when it reaches the left edge.
- Randomize the Y position of each clone for variety.
- 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.
- Choose a parrot or bird sprite (or use 'Parrot' from library).
- Rename it 'Flappy'.
- Position at X: -50, Y: 0.
- Shrink to 25% size.
- Add two costumes: wings up and wings down.
- 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.
- Add code: when space key pressed.
- Change Y by 20 (jump up).
- Switch between wing costumes rapidly.
- 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.
- Add code: if touching Pipes, broadcast 'GameOver' and stop all.
- Display 'GAME OVER' text on screen.
- Track score: when bird passes a pipe (X coordinate crosses pipe), add 1 point.
- Display score with a variable.
- 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.