|
| 1 | +# Flappy-Bird-Game |
| 2 | + |
| 3 | +Flappy Bird is a popular Pygame-based game where players control a bird flying through pipes by tapping the spacebar. The objective is to avoid collisions and navigate through gaps. It's addictive, challenging, and features simple mechanics with a focus on timing and precision. |
| 4 | + |
| 5 | + |
| 6 | +## Setup instructions |
| 7 | + |
| 8 | +- Clone the repository to your local machine. |
| 9 | + |
| 10 | + |
| 11 | +- Install the required dependencies using pip. |
| 12 | + |
| 13 | +``` |
| 14 | +pip install pygame |
| 15 | +``` |
| 16 | + |
| 17 | +- Run the game script |
| 18 | + |
| 19 | +``` |
| 20 | +python main.py |
| 21 | +``` |
| 22 | + |
| 23 | + |
| 24 | +## Detailed explanation of script, if needed |
| 25 | + |
| 26 | +Explanation: |
| 27 | + |
| 28 | +1. Import the necessary modules and initialize Pygame. |
| 29 | + |
| 30 | +2. Define the dimensions of the game window. |
| 31 | + |
| 32 | +3. Create the game window and set its caption. |
| 33 | + |
| 34 | +4. Load the game assets, including the background image, bird sprite, and pipe image. |
| 35 | + |
| 36 | +5. Define the initial position and speed of the bird. |
| 37 | + |
| 38 | +6. Set the initial position, speed, and gap between the pipes. |
| 39 | + |
| 40 | +7. Initialize the score and create a font object for rendering the score text. |
| 41 | + |
| 42 | +8. Enter the game loop, which runs until the `crashTest` variable is set to `False`. |
| 43 | + |
| 44 | +9. Handle Pygame events, such as quitting the game or triggering the bird to jump when the spacebar is pressed. |
| 45 | + |
| 46 | +10. Update the bird's position by adjusting its speed based on gravity. |
| 47 | + |
| 48 | +11. Update the pipe's position by moving it to the left, and reset its position when it goes off the screen. |
| 49 | + |
| 50 | +12. Check for collisions between the bird and the pipes. If a collision occurs, either end the game or increase the score. |
| 51 | + |
| 52 | +13. Draw the background, bird, pipe, and score text on the game window. |
| 53 | + |
| 54 | +14. Update the display to show the changes. |
| 55 | + |
| 56 | +15. When the game loop ends, quit Py |
| 57 | + |
| 58 | +## Output |
| 59 | + |
| 60 | +<img src="screenshot.gif" height="45%"> |
| 61 | + |
| 62 | +## Author(s) |
| 63 | + |
| 64 | +#### Avantika Pandey |
| 65 | +- LinkedIN: https://www.linkedin.com/in/avantika-pandey-2759941ab |
| 66 | +- GitHub: https://github.com/codewithavantika |
| 67 | + |
0 commit comments