|
| 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 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +## Author(s) |
| 73 | + |
| 74 | +Rammya Dharshini K |
| 75 | + |
| 76 | +## Disclaimers, if any |
| 77 | + |
| 78 | +None |
| 79 | + |
0 commit comments