# nuistmrchest/chestgame architecture

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

- Interactive diagram: https://gitdiagram.com/nuistmrchest/chestgame
- Repository: https://github.com/nuistmrchest/chestgame

## Overview

This is a browser-based canvas shooter. The player uses keyboard or touch controls to move and fire; the game loop spawns hazards and enemies, updates combat, tracks score and boss health, and resets on victory or defeat. The sampled code shows that `main.js` owns this orchestration and directly creates and updates the entity classes. The tree and excerpts do not show the HTML or styling contents, so the graph focuses on the evidenced runtime; unsampled UI details are omitted.

Main entry points: [`main.js`](https://github.com/nuistmrchest/chestgame/blob/main/main.js) (Game orchestration), [`mine.js`](https://github.com/nuistmrchest/chestgame/blob/main/mine.js) (Mines), [`bul.js`](https://github.com/nuistmrchest/chestgame/blob/main/bul.js) (Bullets), [`ene.js`](https://github.com/nuistmrchest/chestgame/blob/main/ene.js) (Enemies)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_loop["Game loop"]
  node_game["Game orchestration<br/>[main.js]"]
end

subgraph group_combat["Combat entities"]
  node_boss["Boss<br/>[boss.js]"]
  node_bullets["Bullets<br/>[bul.js]"]
  node_friends["Friendly units<br/>[fri.js]"]
end

subgraph group_hazards["Hazards and foes"]
  node_mines["Mines<br/>[mine.js]"]
  node_enemies["Enemies<br/>[ene.js]"]
end

node_player(("Player"))

node_player -->|"controls"| node_game
node_game -->|"creates and updates"| node_boss
node_game -->|"creates and updates"| node_bullets
node_game -->|"spawns and updates"| node_mines
node_game -->|"spawns and updates"| node_enemies
node_game -->|"spawns and updates"| node_friends
node_enemies -->|"uses movement speed"| node_mines
node_bullets -->|"uses movement speed"| node_mines

click node_game "https://github.com/nuistmrchest/chestgame/blob/main/main.js"
click node_boss "https://github.com/nuistmrchest/chestgame/blob/main/boss.js"
click node_bullets "https://github.com/nuistmrchest/chestgame/blob/main/bul.js"
click node_mines "https://github.com/nuistmrchest/chestgame/blob/main/mine.js"
click node_enemies "https://github.com/nuistmrchest/chestgame/blob/main/ene.js"
click node_friends "https://github.com/nuistmrchest/chestgame/blob/main/fri.js"

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_game toneBlue
class node_boss,node_bullets,node_friends toneAmber
class node_mines,node_enemies toneMint
class node_player toneIndigo
```

## Components

### Game loop

- [Game orchestration](https://github.com/nuistmrchest/chestgame/blob/main/main.js): `main.js`

### Combat entities

- [Boss](https://github.com/nuistmrchest/chestgame/blob/main/boss.js): `boss.js`
- [Bullets](https://github.com/nuistmrchest/chestgame/blob/main/bul.js): `bul.js`
- [Friendly units](https://github.com/nuistmrchest/chestgame/blob/main/fri.js): `fri.js`

### Hazards and foes

- [Mines](https://github.com/nuistmrchest/chestgame/blob/main/mine.js): `mine.js`
- [Enemies](https://github.com/nuistmrchest/chestgame/blob/main/ene.js): `ene.js`

### Other components

- **Player**

## Connections

- Player → Game orchestration: controls (evidence: `main.js`)
- Game orchestration → Boss: creates and updates (evidence: `main.js`)
- Game orchestration → Bullets: creates and updates (evidence: `main.js`)
- Game orchestration → Mines: spawns and updates (evidence: `main.js`)
- Game orchestration → Enemies: spawns and updates (evidence: `main.js`)
- Game orchestration → Friendly units: spawns and updates (evidence: `main.js`)
- Enemies → Mines: uses movement speed (evidence: `ene.js`)
- Bullets → Mines: uses movement speed (evidence: `bul.js`)
