Skip to content

Commit e323673

Browse files
Merge pull request prathimacode-hub#766 from rammya29/main
Squirrel Game
2 parents 6b33f57 + bfeab08 commit e323673

File tree

12 files changed

+537
-0
lines changed

12 files changed

+537
-0
lines changed
Loading
140 Bytes
Loading
146 Bytes
Loading
163 Bytes
Loading
176 Bytes
Loading
208 Bytes
Loading
5.74 KB
Loading
8.44 KB
Loading
6.94 MB
Binary file not shown.

Diff for: PyGamesScripts/Squirrel Eating Game/README.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Squirrel Game
2+
3+
## Aim
4+
5+
The aim of this project is to create a game using pygame module.
6+
7+
8+
## Short description of package/script
9+
10+
- If standalone script, short description of script explaining what it achieves.
11+
The player controls a small squirrel that must hop around the screen eating smaller squirrels and avoiding larger squirrels. Each time the player’s squirrel eats a squirrel that is smaller than it, it grows larger. If the player’s squirrel gets hit by a larger squirrel larger than it, it loses a life point.
12+
13+
- List out the libraries imported.
14+
- random
15+
- pygame
16+
- sys
17+
- time
18+
- math
19+
20+
## Setup instructions
21+
22+
Download the squirrel python code file.
23+
24+
Install the pygame module - `pip install pygame`
25+
26+
Double click the code and enjoy the game.
27+
28+
## Workflow
29+
- Importing the required modules
30+
- Describing the Data Structures
31+
- The main() Function
32+
- The pygame.transform.flip() Function
33+
- A More Detailed Game State than Usual
34+
- The Usual Text Creation Code
35+
- The “Active Area” set-up
36+
- Keeping Track of the Location of Things in the Game World
37+
- Starting Off with Some Grass
38+
- The Game Loop and Checking to Disable Invulnerability
39+
- Moving the Enemy Squirrels
40+
- Removing the Far Away Grass and Squirrel Objects
41+
- When Deleting Items in a List, Iterate Over the List in Reverse
42+
- Adding New Grass and Squirrel Objects
43+
- Camera Slack, and Moving the Camera View
44+
- Drawing the Background, Grass, Squirrels, and Health Meter
45+
- The Event Handling Loop
46+
- Moving the Player, and Accounting for Bounce
47+
- Collision Detection- Eat or Be Eaten
48+
- The Game Over Screen and Winning
49+
- Drawing a Graphical Health Meter
50+
- The Same Old terminate() Function
51+
- The Mathematics of the Sine Function
52+
- Backwards Compatibility with Python Version 2
53+
- The getRandomVelocity() Function
54+
- Finding a Place to Add New Squirrels and Grass
55+
- Creating Enemy Squirrel Data Structures
56+
- Flipping the Squirrel Image
57+
- Creating Grass Data Structures
58+
- Checking if Outside the Active Area
59+
60+
## Output
61+
62+
63+
64+
https://user-images.githubusercontent.com/70591317/125824918-1f785159-5d10-4f01-a7b0-e398e7294263.mp4
65+
66+
67+
68+
![](https://github.com/rammya29/Awesome_Python_Scripts/blob/main/PyGamesScripts/Squirrel%20Eating%20Game/Images/Output/Image-1.png)
69+
70+
![](https://github.com/rammya29/Awesome_Python_Scripts/blob/main/PyGamesScripts/Squirrel%20Eating%20Game/Images/Output/Image-2.png)
71+
72+
## Author(s)
73+
74+
Rammya Dharshini K
75+
76+
## Disclaimers, if any
77+
78+
None
79+

Diff for: PyGamesScripts/Squirrel Eating Game/requirements.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
1. pygame
2+
2. random
3+
3. sys
4+
4. time
5+
5. math

0 commit comments

Comments
 (0)