# shreyaskumbhar4-hub/space-dodge-game architecture

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

- Interactive diagram: https://gitdiagram.com/shreyaskumbhar4-hub/space-dodge-game
- Repository: https://github.com/shreyaskumbhar4-hub/space-dodge-game

## Overview

Space Dodge is a single-file Pygame game: the player steers a ship to avoid falling asteroids, earns points by surviving, and can restart after a collision. The main loop coordinates movement, spawning, scoring, collision effects, and drawing. A local JSON file stores the high score. All game behavior is in main.py; the wiring shown is based on the sampled source.

Main entry points: [`main.py`](https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py) (Game loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_player(("Player"))
node_loop["Game loop<br/>[main.py]"]
node_movement["Movement<br/>[main.py]"]
node_enemies["Asteroids and scoring<br/>[main.py]"]
node_collision["Collision and effects<br/>[main.py]"]
node_render["Rendering and UI<br/>[main.py]"]
node_scores["High score handling<br/>[main.py]"]
node_json[("High score JSON")]
node_pygame["Pygame"]

node_player -->|"gives input"| node_loop
node_loop -->|"updates position"| node_movement
node_loop -->|"spawns and updates"| node_enemies
node_loop -->|"checks collision"| node_collision
node_loop -->|"draws frame"| node_render
node_loop -->|"loads and saves"| node_scores
node_collision -->|"checks overlap"| node_enemies
node_collision -->|"plays sound"| node_pygame
node_scores -->|"reads and writes"| node_json
node_movement -->|"reads keys"| node_pygame
node_render -->|"draws and displays"| node_pygame

click node_loop "https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py"
click node_movement "https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py"
click node_enemies "https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py"
click node_collision "https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py"
click node_render "https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py"
click node_scores "https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.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_player,node_pygame toneIndigo
class node_loop,node_movement,node_enemies,node_collision,node_scores toneTeal
class node_render toneBlue
class node_json toneAmber
```

## Components

### Other components

- **Player**
- [Game loop](https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py): `main.py`
- [Movement](https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py): `main.py`
- [Asteroids and scoring](https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py): `main.py`
- [Collision and effects](https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py): `main.py`
- [Rendering and UI](https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py): `main.py`
- [High score handling](https://github.com/shreyaskumbhar4-hub/space-dodge-game/blob/main/main.py): `main.py`
- **High score JSON**
- **Pygame**

## Connections

- Player → Game loop: gives input
- Game loop → Movement: updates position
- Game loop → Asteroids and scoring: spawns and updates
- Game loop → Collision and effects: checks collision
- Game loop → Rendering and UI: draws frame
- Game loop → High score handling: loads and saves
- Collision and effects → Asteroids and scoring: checks overlap
- Collision and effects → Pygame: plays sound
- High score handling → High score JSON: reads and writes
- Movement → Pygame: reads keys
- Rendering and UI → Pygame: draws and displays
