# debugdwrld/zero-to-hero-z2h architecture

> Architecture diagram of the GitHub repository debugdwrld/zero-to-hero-z2h, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/debugdwrld/zero-to-hero-z2h
- Repository: https://github.com/debugdwrld/zero-to-hero-z2h

## Overview

Z2H is a Pygame action game. The player starts in the hall, moves and fights through levels, collects batteries, and returns to use the hall’s battery storage and property-tree menus; the main loop coordinates play and the renderer presents the result. Combat, player progression, level/world representation, and hall interactions are distinct runtime concerns. README also describes skills, energy, HUD, and level switching. Some main-loop wiring and unsampled modules are not shown, so uncertain links are omitted.

Main entry points: [`main.py`](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/main.py) (Game loop), [`bullet.py`](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/bullet.py) (Projectile combat), [`initial.py`](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/initial.py) (Game initialization), [`render.py`](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/render.py) (Rendering and HUD)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_main["Game loop<br/>[main.py]"]
  node_initial["Game initialization<br/>[initial.py]"]
end

subgraph group_gameplay["Combat and player"]
  node_player["Player state<br/>[player.py]"]
  node_bullet["Projectile combat<br/>[bullet.py]"]
  node_enemy["Enemy behaviors<br/>[enemy.py]"]
  node_constants["Gameplay constants<br/>[constants.py]"]
end

subgraph group_world["World and progression"]
  node_world_beta["Level layout<br/>[world_beta.py]"]
  node_world["Procedural world<br/>[world.py]"]
  node_starthall["Start hall<br/>[starthall.py]"]
end

subgraph group_presentation["UI and assets"]
  node_menu["Interaction menus<br/>[menu.py]"]
  node_render["Rendering and HUD<br/>[render.py]"]
  node_load["Image loading<br/>[load.py]"]
  node_images["Game images"]
end

node_player_actor(("Player"))

node_player_actor -->|"controls"| node_main
node_main -->|"initializes via"| node_initial
node_initial -->|"loads images"| node_load
node_load -->|"reads assets"| node_images
node_initial -->|"creates"| node_player
node_initial -->|"creates"| node_starthall
node_main -->|"updates projectiles"| node_bullet
node_main -->|"requests drawing"| node_render
node_main -->|"dispatches events"| node_menu
node_menu -->|"updates inventory and skill"| node_player
node_menu -->|"transfers batteries"| node_starthall
node_bullet -->|"uses energy and awards XP"| node_player
node_bullet -->|"checks hit types"| node_enemy
node_bullet -->|"reads combat settings"| node_constants
node_player -->|"reads movement setting"| node_constants
node_render -->|"draws projectiles"| node_bullet
node_render -->|"draws hall"| node_starthall
node_render -->|"reads level metadata"| node_world_beta

click node_main "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/main.py"
click node_initial "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/initial.py"
click node_player "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/player.py"
click node_bullet "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/bullet.py"
click node_enemy "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/enemy.py"
click node_world_beta "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/world_beta.py"
click node_world "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/world.py"
click node_starthall "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/starthall.py"
click node_menu "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/menu.py"
click node_render "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/render.py"
click node_load "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/load.py"
click node_images "https://github.com/debugdwrld/zero-to-hero-z2h/tree/main/Images"
click node_constants "https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/constants.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_main,node_initial toneBlue
class node_player,node_bullet,node_enemy,node_constants toneAmber
class node_world_beta,node_world,node_starthall toneMint
class node_menu,node_render,node_load,node_images toneRose
class node_player_actor toneIndigo
```

## Components

### Game runtime

- [Game loop](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/main.py): `main.py`
- [Game initialization](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/initial.py): `initial.py`

### Combat and player

- [Player state](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/player.py): `player.py`
- [Projectile combat](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/bullet.py): `bullet.py`
- [Enemy behaviors](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/enemy.py): `enemy.py`
- [Gameplay constants](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/constants.py): `constants.py`

### World and progression

- [Level layout](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/world_beta.py): `world_beta.py`
- [Procedural world](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/world.py): `world.py`
- [Start hall](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/starthall.py): `starthall.py`

### UI and assets

- [Interaction menus](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/menu.py): `menu.py`
- [Rendering and HUD](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/render.py): `render.py`
- [Image loading](https://github.com/debugdwrld/zero-to-hero-z2h/blob/main/load.py): `load.py`
- [Game images](https://github.com/debugdwrld/zero-to-hero-z2h/tree/main/Images): `Images`

### Other components

- **Player**

## Connections

- Player → Game loop: controls
- Game loop → Game initialization: initializes via
- Game initialization → Image loading: loads images
- Image loading → Game images: reads assets
- Game initialization → Player state: creates
- Game initialization → Start hall: creates
- Game loop → Projectile combat: updates projectiles
- Game loop → Rendering and HUD: requests drawing
- Game loop → Interaction menus: dispatches events
- Interaction menus → Player state: updates inventory and skill
- Interaction menus → Start hall: transfers batteries
- Projectile combat → Player state: uses energy and awards XP
- Projectile combat → Enemy behaviors: checks hit types
- Projectile combat → Gameplay constants: reads combat settings
- Player state → Gameplay constants: reads movement setting
- Rendering and HUD → Projectile combat: draws projectiles
- Rendering and HUD → Start hall: draws hall
- Rendering and HUD → Level layout: reads level metadata
