A feature-rich, high-performance Flappy Bird clone built in Python using Pygame. Features authentic retro sprite assets, dynamic random themes per session, pixel-perfect mask collisions, physics-based rotation, sound effects, and persistent high scores.
- 🎮 Dynamic Themes: Each game round randomly selects between Day and Night backgrounds, Green and Red pipe variants, and Yellow, Blue, or Red bird characters.
- 🎯 Precise Mask Collision: Implements
pygame.maskoverlap detection for true pixel-perfect collision accuracy with pipes and ground. - 🕊️ Realistic Rotation Physics: Dynamic bird angle rotation reflecting upward flaps and realistic downward dive physics.
- 🎵 Retro Audio & Sound Effects: Included background music loop, wing flap sound, and game over audio effects with built-in fallback error handling.
- 🏆 High Score Persistence: Automatically saves and loads your top high score to a local file (
highscore.txt). - 🔢 Authentic Sprite Digits: Classic Flappy Bird numerical font rendered dynamically using original digit sprites.
- ⌨️ Flexible Controls: Support for Keyboard (
SPACE,UP ARROW,ENTER) and Mouse Click controls.
| Action | Controls |
|---|---|
| Flap / Jump | SPACE | UP ARROW | ENTER | Left Mouse Click |
| Start Game | SPACE | UP ARROW | ENTER | Left Mouse Click |
| Restart Game | SPACE | UP ARROW | ENTER | Left Mouse Click |
| Exit | ESC / Close Window |
Ensure you have Python 3.8+ installed on your system.
-
Clone the repository:
git clone https://github.com/your-username/flappy-bird.git cd flappy-bird -
Install dependencies:
pip install -r requirements.txt
-
Run the game:
python main.py
(or run
python flappy_bird.pydirectly)
├── assets/ # Game graphics (birds, pipes, backgrounds, digits, UI)
│ ├── 0.png ... 9.png # Numeric digit sprites for score display
│ ├── background-day.png # Daytime background sprite
│ ├── background-night.png # Nighttime background sprite
│ ├── base.png # Scrolling ground base sprite
│ ├── bluebird-*.png # Blue bird animation frames
│ ├── redbird-*.png # Red bird animation frames
│ ├── yellowbird-*.png # Yellow bird animation frames
│ ├── pipe-green.png # Green pipe sprite
│ ├── pipe-red.png # Red pipe sprite
│ ├── message.png # Start screen title graphic
│ └── gameover.png # Game over graphic banner
├── background_music.mp3 # Main menu & gameplay background music
├── flap.mp3 # Flap sound effect
├── game_over.wav # Game over sound effect
├── flappy_bird.py # Core game engine & state loop
├── main.py # Standard entry point script
├── requirements.txt # Project dependencies (Pygame)
├── .gitignore # Git ignore rules for Python & build artifacts
└── README.md # Project documentation
This project is open-source and available under the MIT License.
- Classic Flappy Bird graphics created by donguyen.
- Retro audio effects provided by community sound archives.