Skip to content

Repository files navigation

🐤 Flappy Bird (Pygame Edition)

Python Version Pygame License: MIT

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.


✨ Features

  • 🎮 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.mask overlap 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.

🎮 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

🚀 Getting Started

Prerequisites

Ensure you have Python 3.8+ installed on your system.

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/flappy-bird.git
    cd flappy-bird
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the game:

    python main.py

    (or run python flappy_bird.py directly)


📁 Repository Structure

├── 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

🛠️ Built With

  • Python - Core Programming Language
  • Pygame - Multimedia Library for 2D Game Development

📜 License

This project is open-source and available under the MIT License.


🙏 Acknowledgments

  • Classic Flappy Bird graphics created by donguyen.
  • Retro audio effects provided by community sound archives.

About

Classic Flappy Bird game built in Python using Pygame with pixel-perfect collision detection, multi-color bird variants, retro sound effects, and persistent high score tracking.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages