# geluhua/shooting_meteorites architecture

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

- Interactive diagram: https://gitdiagram.com/geluhua/shooting_meteorites
- Repository: https://github.com/geluhua/shooting_meteorites

## Overview

This is a browser-based Canvas space-shooter. The player starts or restarts a run, moves and aims the ship, fires at falling meteors, and earns combo-multiplied score; collisions can cost lives, and zero lives ends the run. Game is the runtime orchestrator for simulation, state, rendering, audio, and HUD. The README documents the visual effects, meteor splitting, difficulty scaling, and controls. Connections reflect shown Game calls and indexed imports; unsampled modules are represented only where their roles or capabilities are supported.

Main entry points: [`src/game/Game.ts`](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Game.ts) (Game loop), [`src/utils/math.ts`](https://github.com/geluhua/shooting_meteorites/blob/main/src/utils/math.ts) (Math helpers), [`src/game/Player.ts`](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Player.ts) (Ship state), [`src/game/Bullet.ts`](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Bullet.ts) (Bullet manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_entry["Application entry<br/>[main.ts]"]
  node_game["Game loop<br/>[Game.ts]"]
end

subgraph group_simulation["Gameplay simulation"]
  node_input["Input controls<br/>[Input.ts]"]
  node_ship_state["Ship state<br/>[Player.ts]"]
  node_bullets["Bullet manager<br/>[Bullet.ts]"]
  node_collision["Collision checks<br/>[Collision.ts]"]
  node_meteors["Meteor lifecycle<br/>[Meteor.ts]"]
  node_particles["Particle system<br/>[Particle.ts]"]
  node_audio["Synth audio<br/>[Audio.ts]"]
end

subgraph group_presentation["Canvas presentation"]
  node_starfield["Starfield<br/>[Starfield.ts]"]
  node_hud["Score and HUD<br/>[HUD.ts]"]
  node_overlays["Menu and end screen<br/>[Overlay.ts]"]
  node_ship_render["Ship rendering<br/>[drawShip.ts]"]
  node_meteor_render["Meteor rendering<br/>[drawMeteor.ts]"]
  node_effects["Visual effects<br/>[effects.ts]"]
end

subgraph group_support["Shared utilities"]
  node_math["Math helpers<br/>[math.ts]"]
  node_pool["Object pool<br/>[pool.ts]"]
end

node_player_actor(("Player"))

node_player_actor -->|"opens game"| node_entry
node_entry -->|"imports"| node_game
node_game -->|"reads controls"| node_input
node_game -->|"updates ship"| node_ship_state
node_game -->|"updates and draws"| node_bullets
node_game -->|"checks hits"| node_collision
node_game -->|"spawns and updates"| node_meteors
node_game -->|"updates and draws"| node_particles
node_game -->|"plays sounds"| node_audio
node_game -->|"updates and draws"| node_starfield
node_game -->|"updates and draws"| node_hud
node_game -->|"draws screens"| node_overlays
node_game -->|"draws ship"| node_ship_render
node_game -->|"applies effects"| node_effects
node_game -->|"chooses spawn position"| node_math
node_meteors -->|"delegates drawing"| node_meteor_render
node_meteor_render -->|"uses glow"| node_effects
node_bullets -->|"acquires and releases"| node_pool
node_bullets -->|"uses glow"| node_effects
node_collision -->|"uses distance checks"| node_math
node_input -->|"normalizes movement"| node_math
node_ship_state -->|"reads controls"| node_input
node_ship_state -->|"clamps position"| node_math
node_starfield -->|"uses random ranges"| node_math
node_particles -->|"uses pooled objects"| node_pool

click node_entry "https://github.com/geluhua/shooting_meteorites/blob/main/src/main.ts"
click node_game "https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Game.ts"
click node_input "https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Input.ts"
click node_ship_state "https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Player.ts"
click node_bullets "https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Bullet.ts"
click node_collision "https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Collision.ts"
click node_meteors "https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Meteor.ts"
click node_particles "https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Particle.ts"
click node_audio "https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Audio.ts"
click node_starfield "https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Starfield.ts"
click node_hud "https://github.com/geluhua/shooting_meteorites/blob/main/src/ui/HUD.ts"
click node_overlays "https://github.com/geluhua/shooting_meteorites/blob/main/src/ui/Overlay.ts"
click node_ship_render "https://github.com/geluhua/shooting_meteorites/blob/main/src/render/drawShip.ts"
click node_meteor_render "https://github.com/geluhua/shooting_meteorites/blob/main/src/render/drawMeteor.ts"
click node_effects "https://github.com/geluhua/shooting_meteorites/blob/main/src/render/effects.ts"
click node_math "https://github.com/geluhua/shooting_meteorites/blob/main/src/utils/math.ts"
click node_pool "https://github.com/geluhua/shooting_meteorites/blob/main/src/utils/pool.ts"

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_entry,node_game toneBlue
class node_input,node_ship_state,node_bullets,node_collision,node_meteors,node_particles,node_audio toneAmber
class node_starfield,node_hud,node_overlays,node_ship_render,node_meteor_render,node_effects toneMint
class node_math,node_pool toneRose
class node_player_actor toneIndigo
```

## Components

### Game runtime

- [Application entry](https://github.com/geluhua/shooting_meteorites/blob/main/src/main.ts): `src/main.ts`
- [Game loop](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Game.ts): `src/game/Game.ts`

### Gameplay simulation

- [Input controls](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Input.ts): `src/game/Input.ts`
- [Ship state](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Player.ts): `src/game/Player.ts`
- [Bullet manager](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Bullet.ts): `src/game/Bullet.ts`
- [Collision checks](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Collision.ts): `src/game/Collision.ts`
- [Meteor lifecycle](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Meteor.ts): `src/game/Meteor.ts`
- [Particle system](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Particle.ts): `src/game/Particle.ts`
- [Synth audio](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Audio.ts): `src/game/Audio.ts`

### Canvas presentation

- [Starfield](https://github.com/geluhua/shooting_meteorites/blob/main/src/game/Starfield.ts): `src/game/Starfield.ts`
- [Score and HUD](https://github.com/geluhua/shooting_meteorites/blob/main/src/ui/HUD.ts): `src/ui/HUD.ts`
- [Menu and end screen](https://github.com/geluhua/shooting_meteorites/blob/main/src/ui/Overlay.ts): `src/ui/Overlay.ts`
- [Ship rendering](https://github.com/geluhua/shooting_meteorites/blob/main/src/render/drawShip.ts): `src/render/drawShip.ts`
- [Meteor rendering](https://github.com/geluhua/shooting_meteorites/blob/main/src/render/drawMeteor.ts): `src/render/drawMeteor.ts`
- [Visual effects](https://github.com/geluhua/shooting_meteorites/blob/main/src/render/effects.ts): `src/render/effects.ts`

### Shared utilities

- [Math helpers](https://github.com/geluhua/shooting_meteorites/blob/main/src/utils/math.ts): `src/utils/math.ts`
- [Object pool](https://github.com/geluhua/shooting_meteorites/blob/main/src/utils/pool.ts): `src/utils/pool.ts`

### Other components

- **Player**

## Connections

- Player → Application entry: opens game (evidence: `README.md`)
- Application entry → Game loop: imports (evidence: `src/main.ts`)
- Game loop → Input controls: reads controls (evidence: `src/game/Game.ts`)
- Game loop → Ship state: updates ship (evidence: `src/game/Game.ts`)
- Game loop → Bullet manager: updates and draws (evidence: `src/game/Game.ts`)
- Game loop → Collision checks: checks hits (evidence: `src/game/Game.ts`)
- Game loop → Meteor lifecycle: spawns and updates (evidence: `src/game/Game.ts`)
- Game loop → Particle system: updates and draws (evidence: `src/game/Game.ts`)
- Game loop → Synth audio: plays sounds (evidence: `src/game/Game.ts`)
- Game loop → Starfield: updates and draws (evidence: `src/game/Game.ts`)
- Game loop → Score and HUD: updates and draws (evidence: `src/game/Game.ts`)
- Game loop → Menu and end screen: draws screens (evidence: `src/game/Game.ts`)
- Game loop → Ship rendering: draws ship (evidence: `src/game/Game.ts`)
- Game loop → Visual effects: applies effects (evidence: `src/game/Game.ts`)
- Game loop → Math helpers: chooses spawn position (evidence: `src/game/Game.ts`)
- Meteor lifecycle → Meteor rendering: delegates drawing (evidence: `src/game/Meteor.ts`)
- Meteor rendering → Visual effects: uses glow (evidence: `src/render/drawMeteor.ts`)
- Bullet manager → Object pool: acquires and releases (evidence: `src/game/Bullet.ts`)
- Bullet manager → Visual effects: uses glow (evidence: `src/game/Bullet.ts`)
- Collision checks → Math helpers: uses distance checks (evidence: `src/game/Collision.ts`)
- Input controls → Math helpers: normalizes movement (evidence: `src/game/Input.ts`)
- Ship state → Input controls: reads controls (evidence: `src/game/Player.ts`)
- Ship state → Math helpers: clamps position (evidence: `src/game/Player.ts`)
- Starfield → Math helpers: uses random ranges (evidence: `src/game/Starfield.ts`)
- Particle system → Object pool: uses pooled objects (evidence: `src/game/Particle.ts`)
