# jmini392/2dgp_project architecture

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

- Interactive diagram: https://gitdiagram.com/jmini392/2dgp_project
- Repository: https://github.com/jmini392/2dgp_project

## Overview

This is a Python action-game project. The principal workflow starts at the title, enters play, creates the player and first stage, then advances through enemy and shop stages toward the final boss; combat, collisions, inventory, and player status drive the result. A separate shop mode supports purchases. The graph reflects the sampled runtime calls and SOURCE INDEX references; several modules are indexed but their implementations were not sampled, so their internal behavior and unshown connections are omitted.

Main entry points: [`play_mode.py`](https://github.com/jmini392/2dgp_project/blob/master/play_mode.py) (Play Mode), [`game_world.py`](https://github.com/jmini392/2dgp_project/blob/master/game_world.py) (Game World), [`stage_manager.py`](https://github.com/jmini392/2dgp_project/blob/master/stage_manager.py) (Stage Manager), [`player.py`](https://github.com/jmini392/2dgp_project/blob/master/player.py) (Player Character)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_modes["Game Modes"]
  node_main["Game Entry<br/>[main.py]"]
  node_logo["Logo Mode<br/>[logo_mode.py]"]
  node_title["Title Mode<br/>[title_mode.py]"]
  node_play["Play Mode<br/>[play_mode.py]"]
  node_shopmode["Shop Mode<br/>[shop_mode.py]"]
end

subgraph group_world["World and Stages"]
  node_stage["Stage Manager<br/>[stage_manager.py]"]
  node_background["Background Manager"]
  node_backdrop["Background<br/>[background.py]"]
  node_item["Items<br/>[item.py]"]
  node_shop["Shop<br/>[shop.py]"]
end

subgraph group_combat["Combat and AI"]
  node_player["Player Character<br/>[player.py]"]
  node_attack["Player Attack<br/>[attack.py]"]
  node_gorgon["Gorgon Enemies<br/>[gorgon.py]"]
  node_wizard["Wizard Enemies<br/>[wizard.py]"]
  node_boss["Final Boss<br/>[boss.py]"]
  node_behavior["Behavior Trees<br/>[behavior_tree.py]"]
end

subgraph group_runtime["Runtime Services"]
  node_framework["Mode Framework<br/>[framework.py]"]
  node_gameworld["Game World<br/>[game_world.py]"]
  node_ui["HUD and Enemy UI<br/>[ui.py]"]
  node_share["Shared State<br/>[share.py]"]
  node_state["State Machine<br/>[state_machine.py]"]
  node_eventstring["Event Names<br/>[event_to_string.py]"]
end

node_user(("Player"))

node_user -.->|"starts"| node_main
node_main -->|"starts mode"| node_logo
node_main -->|"runs"| node_framework
node_logo -->|"changes mode"| node_framework
node_logo -->|"enters"| node_title
node_title -->|"starts game"| node_play
node_title -->|"changes mode"| node_framework
node_play -->|"creates"| node_player
node_play -->|"loads stages"| node_stage
node_play -->|"creates manager"| node_background
node_play -->|"updates and renders"| node_gameworld
node_play -->|"opens"| node_shopmode
node_play -->|"returns to"| node_title
node_play -->|"reads and writes"| node_share
node_stage -->|"creates"| node_gorgon
node_stage -->|"creates"| node_wizard
node_stage -->|"creates"| node_boss
node_stage -->|"creates"| node_shop
node_stage -->|"registers objects"| node_gameworld
node_background -->|"creates"| node_backdrop
node_background -->|"checks objects"| node_gameworld
node_background -->|"changes music"| node_share
node_player -->|"uses"| node_state
node_player -->|"creates"| node_attack
node_player -->|"registers objects"| node_gameworld
node_player -->|"creates HUD"| node_ui
node_player -->|"uses"| node_share
node_gorgon -->|"runs AI"| node_behavior
node_wizard -->|"runs AI"| node_behavior
node_boss -->|"runs AI"| node_behavior
node_gorgon -->|"creates status UI"| node_ui
node_wizard -->|"creates status UI"| node_ui
node_boss -->|"creates status UI"| node_ui
node_gorgon -->|"drops items"| node_item
node_wizard -->|"drops items"| node_item
node_gorgon -->|"registers objects"| node_gameworld
node_wizard -->|"registers objects"| node_gameworld
node_boss -->|"registers attacks"| node_gameworld
node_shopmode -->|"uses"| node_shop
node_shopmode -->|"updates world"| node_gameworld
node_shopmode -->|"changes mode"| node_framework
node_shopmode -->|"uses"| node_share
node_state -->|"uses names"| node_eventstring
node_item -->|"uses"| node_gameworld

click node_main "https://github.com/jmini392/2dgp_project/blob/master/main.py"
click node_logo "https://github.com/jmini392/2dgp_project/blob/master/logo_mode.py"
click node_title "https://github.com/jmini392/2dgp_project/blob/master/title_mode.py"
click node_play "https://github.com/jmini392/2dgp_project/blob/master/play_mode.py"
click node_shopmode "https://github.com/jmini392/2dgp_project/blob/master/shop_mode.py"
click node_framework "https://github.com/jmini392/2dgp_project/blob/master/framework.py"
click node_player "https://github.com/jmini392/2dgp_project/blob/master/player.py"
click node_attack "https://github.com/jmini392/2dgp_project/blob/master/attack.py"
click node_gorgon "https://github.com/jmini392/2dgp_project/blob/master/gorgon.py"
click node_wizard "https://github.com/jmini392/2dgp_project/blob/master/wizard.py"
click node_boss "https://github.com/jmini392/2dgp_project/blob/master/boss.py"
click node_behavior "https://github.com/jmini392/2dgp_project/blob/master/behavior_tree.py"
click node_stage "https://github.com/jmini392/2dgp_project/blob/master/stage_manager.py"
click node_background "https://github.com/jmini392/2dgp_project/blob/master/background_manager.py"
click node_backdrop "https://github.com/jmini392/2dgp_project/blob/master/background.py"
click node_item "https://github.com/jmini392/2dgp_project/blob/master/item.py"
click node_shop "https://github.com/jmini392/2dgp_project/blob/master/shop.py"
click node_gameworld "https://github.com/jmini392/2dgp_project/blob/master/game_world.py"
click node_ui "https://github.com/jmini392/2dgp_project/blob/master/ui.py"
click node_share "https://github.com/jmini392/2dgp_project/blob/master/share.py"
click node_state "https://github.com/jmini392/2dgp_project/blob/master/state_machine.py"
click node_eventstring "https://github.com/jmini392/2dgp_project/blob/master/event_to_string.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_logo,node_title,node_play,node_shopmode toneBlue
class node_stage,node_background,node_backdrop,node_item,node_shop toneAmber
class node_player,node_attack,node_gorgon,node_wizard,node_boss,node_behavior toneMint
class node_framework,node_gameworld,node_ui,node_share,node_state,node_eventstring toneRose
class node_user toneIndigo
```

## Components

### Game Modes

- [Game Entry](https://github.com/jmini392/2dgp_project/blob/master/main.py): `main.py`
- [Logo Mode](https://github.com/jmini392/2dgp_project/blob/master/logo_mode.py): `logo_mode.py`
- [Title Mode](https://github.com/jmini392/2dgp_project/blob/master/title_mode.py): `title_mode.py`
- [Play Mode](https://github.com/jmini392/2dgp_project/blob/master/play_mode.py): `play_mode.py`
- [Shop Mode](https://github.com/jmini392/2dgp_project/blob/master/shop_mode.py): `shop_mode.py`

### World and Stages

- [Stage Manager](https://github.com/jmini392/2dgp_project/blob/master/stage_manager.py): `stage_manager.py`
- [Background Manager](https://github.com/jmini392/2dgp_project/blob/master/background_manager.py): `background_manager.py`
- [Background](https://github.com/jmini392/2dgp_project/blob/master/background.py): `background.py`
- [Items](https://github.com/jmini392/2dgp_project/blob/master/item.py): `item.py`
- [Shop](https://github.com/jmini392/2dgp_project/blob/master/shop.py): `shop.py`

### Combat and AI

- [Player Character](https://github.com/jmini392/2dgp_project/blob/master/player.py): `player.py`
- [Player Attack](https://github.com/jmini392/2dgp_project/blob/master/attack.py): `attack.py`
- [Gorgon Enemies](https://github.com/jmini392/2dgp_project/blob/master/gorgon.py): `gorgon.py`
- [Wizard Enemies](https://github.com/jmini392/2dgp_project/blob/master/wizard.py): `wizard.py`
- [Final Boss](https://github.com/jmini392/2dgp_project/blob/master/boss.py): `boss.py`
- [Behavior Trees](https://github.com/jmini392/2dgp_project/blob/master/behavior_tree.py): `behavior_tree.py`

### Runtime Services

- [Mode Framework](https://github.com/jmini392/2dgp_project/blob/master/framework.py): `framework.py`
- [Game World](https://github.com/jmini392/2dgp_project/blob/master/game_world.py): `game_world.py`
- [HUD and Enemy UI](https://github.com/jmini392/2dgp_project/blob/master/ui.py): `ui.py`
- [Shared State](https://github.com/jmini392/2dgp_project/blob/master/share.py): `share.py`
- [State Machine](https://github.com/jmini392/2dgp_project/blob/master/state_machine.py): `state_machine.py`
- [Event Names](https://github.com/jmini392/2dgp_project/blob/master/event_to_string.py): `event_to_string.py`

### Other components

- **Player**

## Connections

- Player → Game Entry: starts
- Game Entry → Logo Mode: starts mode (evidence: `main.py`)
- Game Entry → Mode Framework: runs (evidence: `main.py`)
- Logo Mode → Mode Framework: changes mode (evidence: `logo_mode.py`)
- Logo Mode → Title Mode: enters (evidence: `logo_mode.py`)
- Title Mode → Play Mode: starts game (evidence: `title_mode.py`)
- Title Mode → Mode Framework: changes mode (evidence: `title_mode.py`)
- Play Mode → Player Character: creates (evidence: `play_mode.py`)
- Play Mode → Stage Manager: loads stages (evidence: `play_mode.py`)
- Play Mode → Background Manager: creates manager (evidence: `play_mode.py`)
- Play Mode → Game World: updates and renders (evidence: `play_mode.py`)
- Play Mode → Shop Mode: opens (evidence: `play_mode.py`)
- Play Mode → Title Mode: returns to (evidence: `play_mode.py`)
- Play Mode → Shared State: reads and writes (evidence: `play_mode.py`)
- Stage Manager → Gorgon Enemies: creates (evidence: `stage_manager.py`)
- Stage Manager → Wizard Enemies: creates (evidence: `stage_manager.py`)
- Stage Manager → Final Boss: creates (evidence: `stage_manager.py`)
- Stage Manager → Shop: creates (evidence: `stage_manager.py`)
- Stage Manager → Game World: registers objects (evidence: `stage_manager.py`)
- Background Manager → Background: creates (evidence: `background_manager.py`)
- Background Manager → Game World: checks objects (evidence: `background_manager.py`)
- Background Manager → Shared State: changes music (evidence: `background_manager.py`)
- Player Character → State Machine: uses (evidence: `player.py`)
- Player Character → Player Attack: creates (evidence: `player.py`)
- Player Character → Game World: registers objects (evidence: `player.py`)
- Player Character → HUD and Enemy UI: creates HUD (evidence: `player.py`)
- Player Character → Shared State: uses (evidence: `player.py`)
- Gorgon Enemies → Behavior Trees: runs AI (evidence: `gorgon.py`)
- Wizard Enemies → Behavior Trees: runs AI (evidence: `wizard.py`)
- Final Boss → Behavior Trees: runs AI (evidence: `boss.py`)
- Gorgon Enemies → HUD and Enemy UI: creates status UI (evidence: `gorgon.py`)
- Wizard Enemies → HUD and Enemy UI: creates status UI (evidence: `wizard.py`)
- Final Boss → HUD and Enemy UI: creates status UI (evidence: `boss.py`)
- Gorgon Enemies → Items: drops items (evidence: `gorgon.py`)
- Wizard Enemies → Items: drops items (evidence: `wizard.py`)
- Gorgon Enemies → Game World: registers objects (evidence: `gorgon.py`)
- Wizard Enemies → Game World: registers objects (evidence: `wizard.py`)
- Final Boss → Game World: registers attacks (evidence: `boss.py`)
- Shop Mode → Shop: uses (evidence: `shop_mode.py`)
- Shop Mode → Game World: updates world (evidence: `shop_mode.py`)
- Shop Mode → Mode Framework: changes mode (evidence: `shop_mode.py`)
- Shop Mode → Shared State: uses (evidence: `shop_mode.py`)
- State Machine → Event Names: uses names (evidence: `state_machine.py`)
- Items → Game World: uses (evidence: `item.py`)
