9: Squirrel Eat Squirrel Last updated Dec 1, 2020 Save as PDF Index Front Matter Page ID13617 ( \newcommand{\kernel}{\mathrm{null}\,}\) 9.1: How to Play Squirrel Eat Squirrel9.2: The Design of Squirrel Eat Squirrel9.3: Source Code to Squirrel Eat Squirrel9.4: The Usual Setup Code9.5: Describing the Data Structures9.6: The main() Function9.7: The pygame.transform.flip() Function9.8: A More Detailed Game State than Usual9.9: The Usual Text Creation Code9.10: Cameras9.11: The “Active Area”9.12: Keeping Track of the Location of Things in the Game World9.13: Starting Off with Some Grass9.14: The Game Loop9.15: Checking to Disable Invulnerability9.16: Moving the Enemy Squirrels9.17: Removing the Far Away Grass and Squirrel Objects9.18: When Deleting Items in a List, Iterate Over the List in Reverse9.19: Adding New Grass and Squirrel Objects9.20: Camera Slack, and Moving the Camera View9.21: Drawing the Background, Grass, Squirrels, and Health Meter9.22: The Event Handling Loop9.23: Moving the Player, and Accounting for Bounce9.24: Collision Detection- Eat or Be Eaten9.25: The Game Over Screen9.26: Winning9.27: Drawing a Graphical Health Meter9.28: The Same Old terminate() Function9.29: The Mathematics of the Sine Function9.30: Backwards Compatibility with Python Version 29.31: The getRandomVelocity() Function9.32: Finding a Place to Add New Squirrels and Grass9.33: Creating Enemy Squirrel Data Structures9.34: Flipping the Squirrel Image9.35: Creating Grass Data Structures9.36: Checking if Outside the Active Area9.37: Summary