A simple Flappy Bird game built using Python and Pygame.
- Gravity-based bird movement.
- Pipes randomly generated for obstacles.
- Score tracking.
- Restart functionality.
- Simple and intuitive controls.
- Click the left mouse button to make the bird jump.
- Avoid hitting the pipes and the ground.
- Pass through the gaps between pipes to score points.
Ensure you have Python installed on your system. Then, install Pygame:
pip install pygame- Clone this repository or download the ZIP file.
- Place the necessary image assets in an
imgfolder inside the project directory:bg.png: Background image.ground.png: Ground image.bird1.png,bird2.png,bird3.png: Bird animation frames.pipe.png: Pipe image.restart.png: Restart button image.
- Run the
main.pyfile to start the game:
python main.py- Bird: A class that defines the bird's behavior, including jumping, falling due to gravity, and animation.
- Pipe: A class to handle pipes as obstacles. Pipes are generated at random heights and scroll across the screen.
- Button: A class to handle the restart button functionality.
- The game loop handles drawing the background, pipes, bird, and ground.
- It also checks for collisions and updates the score.
- If the game ends, a restart button is displayed.
The reset_game function clears the pipes, repositions the bird, and resets the score.
Enjoy playing Flappy Bird! 🚀
