How marga8608/simulation-python- works
This repository implements a Pygame farming game: the player plants and harvests carrots while avoiding bunnies that seek and eat ready crops. The runtime starts in a play screen, handles keyboard and mouse input, creates the game world, updates its sprites, and renders the result until the player runs out of coins with no active crops. The graph preserves the distinct player, crop-growth, herbivore, scoring, and rendering responsibilities. Graphics assets referenced by source are not present as runtime image files in the supplied tree, so they are not mapped as working components.
Main entry points: game_functions.py World setup · main.py Game loop · player.py Player controls · herbivore.py Bunny behavior
Components 13
Game runtime
- Game loop
main.py - Event handling
game_functions.py - World setup
game_functions.py - Sprite updates
game_functions.py
Game simulation
- Player controls
player.py - Bunny behavior
herbivore.py - Creature movement
creature.py - Crop growth
planter.py - Static objects
static_object.py - Game score
score_board.py
Display and settings
- Screen rendering
game_functions.py - Game settings
settings.py
Other components
- Player
Connections 22
- Player → Event handling: sends input
- Game loop → Event handling: checks events
main.py - Game loop → World setup: creates world
main.py - Game loop → Sprite updates: updates sprites
main.py - Game loop → Screen rendering: renders frame
main.py - Game loop → Game settings: creates settings
main.py - Event handling → Player controls: sets movement
game_functions.py - World setup → Player controls: creates player
game_functions.py - World setup → Bunny behavior: creates bunnies
game_functions.py - World setup → Crop growth: creates planters
game_functions.py - World setup → Static objects: creates walls
game_functions.py - World setup → Game score: creates score
game_functions.py - Player controls → Creature movement: inherits movement
player.py - Bunny behavior → Creature movement: inherits movement
herbivore.py - Crop growth → Static objects: inherits object
planter.py - Player controls → Crop growth: plants or harvests
player.py - Player controls → Game score: updates score
player.py - Bunny behavior → Crop growth: eats ready crops
herbivore.py - Bunny behavior → Game score: records eating
herbivore.py - Sprite updates → Bunny behavior: updates group
game_functions.py - Sprite updates → Crop growth: updates group
game_functions.py - Screen rendering → Game score: draws score
game_functions.py