# lasryy/leak_to_the_past architecture

> Architecture diagram of the GitHub repository lasryy/leak_to_the_past, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lasryy/leak_to_the_past
- Repository: https://github.com/lasryy/leak_to_the_past
- Video tour (about a minute): https://gitdiagram.com/lasryy/leak_to_the_past/video

## Overview

Leak To The Past is a Pygame survival-action game. The player starts or restarts a run, moves and shoots while enemies spawn and attack, then earns score and may receive drops; the run ends in a game-over state. The main loop coordinates gameplay, rendering, audio, and state changes, while sprites.py implements the player, enemies, projectiles, and effects. The README documents lighting, camera, and several gameplay capabilities beyond the sampled code; those are represented without asserting unsampled call paths.

Main entry points: [`main.py`](https://github.com/lasryy/leak_to_the_past/blob/master/main.py) (Game loop), [`sprites.py`](https://github.com/lasryy/leak_to_the_past/blob/master/sprites.py) (Player controls), [`settings.py`](https://github.com/lasryy/leak_to_the_past/blob/master/settings.py) (Game settings), [`assets/audio`](https://github.com/lasryy/leak_to_the_past/tree/master/assets/audio) (Audio assets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Gameplay"]
  node_player["Player controls<br/>[sprites.py]"]
  node_game["Game loop<br/>[main.py]"]
  node_spawning["Enemy spawning<br/>[main.py]"]
  node_enemy["Enemy behaviors<br/>[sprites.py]"]
  node_combat["Combat &amp; scoring<br/>[main.py]"]
end

subgraph group_world["World &amp; Effects"]
  node_projectiles["Projectiles<br/>[sprites.py]"]
  node_drops["Item drops<br/>[sprites.py]"]
  node_effects["Particles &amp; puddles<br/>[sprites.py]"]
end

subgraph group_presentation["Presentation"]
  node_camera["Camera &amp; fog<br/>[main.py]"]
  node_ui["Game states &amp; HUD<br/>[main.py]"]
  node_audio["Sound &amp; music<br/>[main.py]"]
  node_audiofiles["Audio assets"]
  node_graphics["Graphics assets"]
end

subgraph group_config["Configuration"]
  node_settings["Game settings<br/>[settings.py]"]
end

node_user(("Player"))

node_user -->|"provides input"| node_game
node_game -->|"spawns enemies"| node_spawning
node_spawning -->|"creates"| node_enemy
node_game -->|"handles hits"| node_combat
node_combat -->|"resolves collisions"| node_projectiles
node_combat -->|"may create"| node_drops
node_combat -->|"creates effects"| node_effects
node_enemy -.->|"fires"| node_projectiles
node_game -->|"runs gameplay"| node_player
node_game -->|"renders world"| node_camera
node_game -->|"manages states"| node_ui
node_game -->|"plays audio"| node_audio
node_audio -->|"loads"| node_audiofiles
node_game -->|"loads graphics"| node_graphics
node_player -->|"uses constants"| node_settings
node_game -->|"uses constants"| node_settings

click node_player "https://github.com/lasryy/leak_to_the_past/blob/master/sprites.py"
click node_game "https://github.com/lasryy/leak_to_the_past/blob/master/main.py"
click node_spawning "https://github.com/lasryy/leak_to_the_past/blob/master/main.py"
click node_enemy "https://github.com/lasryy/leak_to_the_past/blob/master/sprites.py"
click node_combat "https://github.com/lasryy/leak_to_the_past/blob/master/main.py"
click node_projectiles "https://github.com/lasryy/leak_to_the_past/blob/master/sprites.py"
click node_drops "https://github.com/lasryy/leak_to_the_past/blob/master/sprites.py"
click node_effects "https://github.com/lasryy/leak_to_the_past/blob/master/sprites.py"
click node_camera "https://github.com/lasryy/leak_to_the_past/blob/master/main.py"
click node_ui "https://github.com/lasryy/leak_to_the_past/blob/master/main.py"
click node_audio "https://github.com/lasryy/leak_to_the_past/blob/master/main.py"
click node_audiofiles "https://github.com/lasryy/leak_to_the_past/tree/master/assets/audio"
click node_graphics "https://github.com/lasryy/leak_to_the_past/tree/master/assets/graphics"
click node_settings "https://github.com/lasryy/leak_to_the_past/blob/master/settings.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_player,node_game,node_spawning,node_enemy,node_combat toneBlue
class node_projectiles,node_drops,node_effects toneAmber
class node_camera,node_ui,node_audio,node_audiofiles,node_graphics toneMint
class node_settings toneRose
class node_user toneIndigo
```

## Components

### Gameplay

- [Player controls](https://github.com/lasryy/leak_to_the_past/blob/master/sprites.py): `sprites.py`
- [Game loop](https://github.com/lasryy/leak_to_the_past/blob/master/main.py): `main.py`
- [Enemy spawning](https://github.com/lasryy/leak_to_the_past/blob/master/main.py): `main.py`
- [Enemy behaviors](https://github.com/lasryy/leak_to_the_past/blob/master/sprites.py): `sprites.py`
- [Combat & scoring](https://github.com/lasryy/leak_to_the_past/blob/master/main.py): `main.py`

### World & Effects

- [Projectiles](https://github.com/lasryy/leak_to_the_past/blob/master/sprites.py): `sprites.py`
- [Item drops](https://github.com/lasryy/leak_to_the_past/blob/master/sprites.py): `sprites.py`
- [Particles & puddles](https://github.com/lasryy/leak_to_the_past/blob/master/sprites.py): `sprites.py`

### Presentation

- [Camera & fog](https://github.com/lasryy/leak_to_the_past/blob/master/main.py): `main.py`
- [Game states & HUD](https://github.com/lasryy/leak_to_the_past/blob/master/main.py): `main.py`
- [Sound & music](https://github.com/lasryy/leak_to_the_past/blob/master/main.py): `main.py`
- [Audio assets](https://github.com/lasryy/leak_to_the_past/tree/master/assets/audio): `assets/audio`
- [Graphics assets](https://github.com/lasryy/leak_to_the_past/tree/master/assets/graphics): `assets/graphics`

### Configuration

- [Game settings](https://github.com/lasryy/leak_to_the_past/blob/master/settings.py): `settings.py`

### Other components

- **Player**

## Connections

- Player → Game loop: provides input (evidence: `README.md`)
- Game loop → Enemy spawning: spawns enemies (evidence: `main.py`)
- Enemy spawning → Enemy behaviors: creates (evidence: `main.py`)
- Game loop → Combat & scoring: handles hits (evidence: `README.md`)
- Combat & scoring → Projectiles: resolves collisions (evidence: `README.md`)
- Combat & scoring → Item drops: may create (evidence: `README.md`)
- Combat & scoring → Particles & puddles: creates effects (evidence: `README.md`)
- Enemy behaviors → Projectiles: fires (evidence: `sprites.py`)
- Game loop → Player controls: runs gameplay (evidence: `README.md`)
- Game loop → Camera & fog: renders world (evidence: `README.md`)
- Game loop → Game states & HUD: manages states (evidence: `README.md`)
- Game loop → Sound & music: plays audio (evidence: `main.py`)
- Sound & music → Audio assets: loads (evidence: `main.py`)
- Game loop → Graphics assets: loads graphics (evidence: `main.py`)
- Player controls → Game settings: uses constants (evidence: `sprites.py`)
- Game loop → Game settings: uses constants (evidence: `main.py`)
