# contactcodeknights/blockgame architecture

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

- Interactive diagram: https://gitdiagram.com/contactcodeknights/blockgame
- Repository: https://github.com/contactcodeknights/blockgame

## Overview

BlockGame is a Pygame platformer with a menu, playable levels, and an in-game level editor. The main workflow is selecting Play, loading the saved tile map, controlling a player through the level, and reaching its exit; selecting the editor instead lets players place tiles and save a map. The graph separates app flow, gameplay, and level authoring. Source excerpts show the runtime and map interactions; unsampled JSON contents and any behavior beyond the documented starter-project scope are not inferred.

Main entry points: [`BlockGame/main.py`](https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/main.py) (Game entry), [`BlockGame/settings.py`](https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/settings.py) (Game settings), [`BlockGame/menu.py`](https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/menu.py) (Main menu), [`BlockGame/editor.py`](https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/editor.py) (Level editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App flow"]
  node_main["Game entry<br/>[main.py]"]
  node_menu["Main menu<br/>[menu.py]"]
  node_settings["Game settings<br/>[settings.py]"]
end

subgraph group_gameplay["Gameplay"]
  node_play["Level runtime<br/>[main.py]"]
  node_player["Player physics<br/>[player.py]"]
end

subgraph group_authoring["Level authoring"]
  node_editor["Level editor<br/>[editor.py]"]
  node_map[("Saved level map<br/>[map_data.json]")]
end

node_user(("Player"))

node_user -->|"chooses action"| node_menu
node_main -->|"runs menu"| node_menu
node_menu -->|"returns choice"| node_main
node_main -->|"starts play"| node_play
node_main -->|"starts editor"| node_editor
node_play -->|"loads map"| node_map
node_editor -->|"loads and saves"| node_map
node_play -->|"updates and draws"| node_player
node_main -->|"imports config"| node_settings
node_menu -->|"imports config"| node_settings
node_play -->|"uses dimensions"| node_settings
node_player -->|"imports config"| node_settings
node_editor -->|"imports config"| node_settings
node_user -->|"controls character"| node_play
node_user -->|"edits tiles"| node_editor

click node_main "https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/main.py"
click node_menu "https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/menu.py"
click node_settings "https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/settings.py"
click node_play "https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/main.py"
click node_player "https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/player.py"
click node_editor "https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/editor.py"
click node_map "https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/map_data.json"

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_menu,node_settings toneBlue
class node_play,node_player toneAmber
class node_editor,node_map toneMint
class node_user toneIndigo
```

## Components

### App flow

- [Game entry](https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/main.py): `BlockGame/main.py`
- [Main menu](https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/menu.py): `BlockGame/menu.py`
- [Game settings](https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/settings.py): `BlockGame/settings.py`

### Gameplay

- [Level runtime](https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/main.py): `BlockGame/main.py`
- [Player physics](https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/player.py): `BlockGame/player.py`

### Level authoring

- [Level editor](https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/editor.py): `BlockGame/editor.py`
- [Saved level map](https://github.com/contactcodeknights/blockgame/blob/main/BlockGame/map_data.json): `BlockGame/map_data.json`

### Other components

- **Player**

## Connections

- Player → Main menu: chooses action (evidence: `BlockGame/menu.py`)
- Game entry → Main menu: runs menu (evidence: `BlockGame/main.py`)
- Main menu → Game entry: returns choice (evidence: `BlockGame/main.py`)
- Game entry → Level runtime: starts play (evidence: `BlockGame/main.py`)
- Game entry → Level editor: starts editor (evidence: `BlockGame/main.py`)
- Level runtime → Saved level map: loads map (evidence: `BlockGame/main.py`)
- Level editor → Saved level map: loads and saves (evidence: `BlockGame/editor.py`)
- Level runtime → Player physics: updates and draws (evidence: `BlockGame/main.py`)
- Game entry → Game settings: imports config (evidence: `BlockGame/main.py`)
- Main menu → Game settings: imports config (evidence: `BlockGame/menu.py`)
- Level runtime → Game settings: uses dimensions (evidence: `BlockGame/main.py`)
- Player physics → Game settings: imports config (evidence: `BlockGame/player.py`)
- Level editor → Game settings: imports config (evidence: `BlockGame/editor.py`)
- Player → Level runtime: controls character
- Player → Level editor: edits tiles (evidence: `BlockGame/editor.py`)
