Skip to content

darshyadav12/Flappy-Bird---Full-PyGame-Clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

🐤 Flappy Bird – Full PyGame Clone

This is a complete Flappy Bird game I built in 7th class while learning Python and PyGame. It includes smooth animations, a welcome screen, moving pipes, sound effects, score counting, collision detection, and a full game loop — just like the real Flappy Bird.

This project helped me understand how video games handle physics, movement, events, and rendering.

Demo

2025-12-08.19-20-40.mp4

Features

  • Fully functional welcome/start screen
  • Gravity-based bird movement
  • Flap mechanic with smooth vertical acceleration
  • Randomly generated pipes
  • Collision detection with top pipes, bottom pipes, and ground
  • Scoreboard using digit sprites
  • Moving base/ground
  • Sound effects: wing, point, hit, die, swoosh
  • Clean game loop with sprite rendering
  • Auto pipe recycling to keep the game infinite
  • Background image + sprite graphics
  • Simple but accurate physics
  • Organized pipe generation using helper functions

How It Works

  • When the game starts, the welcome screen is shown with the background, bird, and message.
  • When the player presses SPACE or the UP arrow, the main game starts.
  • The bird continuously falls due to gravity. When you press SPACE, it flaps upward.
  • Pipes are generated at random heights using the getRandomPipe() function.
  • These pipes move left across the screen to create obstacles.
  • Every time the bird crosses a pipe safely, the score increases.
  • If the bird hits a pipe or touches the ground/sky, the game ends and returns to the welcome screen.
  • The screen is redrawn every frame to show background, pipes, ground, player, and score.
  • Sounds are played at the correct events (wing, point, hit, etc.).

Installation

Install PyGame:

  pip install pygame

Your project folder should look like this:

project-folder/
│ main.py
│
├── gallery/
│   ├── sprites/
│   │   bird.png
│   │   background.png
│   │   pipe.png
│   │   message.png
│   │   base.png
│   │   0.png … 9.png
│   │
│   └── audio/
│       wing.wav
│       point.wav
│       hit.wav
│       die.wav
│       swoosh.wav

Make sure your folder contains:

  • A folder named Images
  • A folder named Sound
  • All .png images and .wav/.mp3 files used by the game
  • Make sure all the file paths match the names used in the code.

Deployment

Run the python file:

  python main.py

Replace main.py with your file’s actual name. The game will open in a PyGame window. Press SPACE or UP to start playing.

Tech Stack

  • Python 3
  • PyGame
  • Sprite rendering
  • Basic 2D animation
  • Physics simulation (gravity, upward velocity)
  • Game loops & frame updates
  • Collision detection
  • Randomized obstacle generation
  • Sound integration

Lessons Learned

  • How to detect keyboard input events
  • How to load sprites, sounds, and handle transparency
  • How to create gravity + flap physics for the bird
  • How to generate pipes at random heights using math
  • How to detect collisions between rectangles
  • How to update display elements such as score digits
  • How to structure a game into functions (welcome screen, main game, pipe generator, collision detector)

Future Improvements

  • Add a leaderboard or high-score save system
  • Add animated bird flapping frames
  • Add difficulty levels
  • Add multiple themes/backgrounds
  • Add a pause menu
  • Add mobile controls (touch input)
  • Export to executable or web version

Credits

This project was inspired by the official Flappy Bird mechanics and built with help from Python + PyGame tutorials I followed in 7th class. All code, game logic, and structuring were written by me

About

This is a complete Flappy Bird game I built in 7th class while learning Python and PyGame.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages