Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f500bf3

Browse files
Merge pull request avinashkranjan#1676 from codewithavantika/new_project/flappy-bird-game
Added Flappy bird game files
2 parents 9194c5a + 2d65b9d commit f500bf3

37 files changed

+279
-0
lines changed

‎Flappy-Bird-Game/README.md‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
17.1 KB
Binary file not shown.
190 KB
Binary file not shown.
15.3 KB
Binary file not shown.
94.3 KB
Binary file not shown.
12.9 KB
Binary file not shown.
173 KB
Binary file not shown.
13.4 KB
Binary file not shown.
346 KB
Binary file not shown.
7.55 KB
Binary file not shown.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /