# gabriel-br2/star_wars_game architecture

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

- Interactive diagram: https://gitdiagram.com/gabriel-br2/star_wars_game
- Repository: https://github.com/gabriel-br2/star_wars_game

## Overview

This repository is a desktop asteroid-escape game: the player enters through the opening/menu flow, then pilots the Falcon through an asteroid field, firing lasers and managing ship health toward a win or loss. The game logic is concentrated in `main.py`; `graphics.py` supplies the drawing and input primitives, while `resource/` holds game assets. The excerpts show the intro/menu calls, collision helpers, and graphics usage; README statements support the broader gameplay capabilities, but unsampled implementation details and some transitions are not inferred.

Main entry points: [`main.py`](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py) (Game loop), [`graphics.py`](https://github.com/gabriel-br2/star_wars_game/blob/main/graphics.py) (Graphics primitives), [`resource`](https://github.com/gabriel-br2/star_wars_game/tree/main/resource) (Images and sprites)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Intro and menus"]
  node_opening["Opening crawl<br/>[main.py]"]
  node_menu["Main menu<br/>[main.py]"]
  node_pause["Pause menu<br/>[main.py]"]
  node_outcome["Win or lose<br/>[main.py]"]
end

subgraph group_gameplay["Gameplay systems"]
  node_game["Game loop<br/>[main.py]"]
  node_falcon["Falcon movement<br/>[main.py]"]
  node_asteroids["Asteroid field<br/>[main.py]"]
  node_lasers["Laser firing<br/>[main.py]"]
  node_collisions["Collision checks<br/>[main.py]"]
  node_health["Ship health<br/>[main.py]"]
  node_explosions["Hit effects<br/>[main.py]"]
end

subgraph group_rendering["Graphics runtime"]
  node_graphics["Graphics primitives<br/>[graphics.py]"]
end

subgraph group_assets["Game assets"]
  node_assets["Images and sprites"]
end

node_player(("Pilot"))

node_player -.->|"starts game"| node_opening
node_opening -->|"continues to"| node_menu
node_player -.->|"selects options"| node_menu
node_menu -.->|"starts play"| node_game
node_player -.->|"controls"| node_game
node_game -.->|"moves"| node_falcon
node_game -.->|"faces waves"| node_asteroids
node_game -.->|"fires"| node_lasers
node_game -->|"checks hits"| node_collisions
node_collisions -.->|"updates"| node_health
node_collisions -->|"triggers effect"| node_explosions
node_game -.->|"ends in"| node_outcome
node_player -.->|"pauses play"| node_pause
node_opening -->|"draws with"| node_graphics
node_menu -->|"draws with"| node_graphics
node_game -->|"renders with"| node_graphics
node_opening -.->|"uses images"| node_assets
node_game -.->|"uses sprites"| node_assets

click node_opening "https://github.com/gabriel-br2/star_wars_game/blob/main/main.py"
click node_menu "https://github.com/gabriel-br2/star_wars_game/blob/main/main.py"
click node_pause "https://github.com/gabriel-br2/star_wars_game/blob/main/main.py"
click node_outcome "https://github.com/gabriel-br2/star_wars_game/blob/main/main.py"
click node_game "https://github.com/gabriel-br2/star_wars_game/blob/main/main.py"
click node_falcon "https://github.com/gabriel-br2/star_wars_game/blob/main/main.py"
click node_asteroids "https://github.com/gabriel-br2/star_wars_game/blob/main/main.py"
click node_lasers "https://github.com/gabriel-br2/star_wars_game/blob/main/main.py"
click node_collisions "https://github.com/gabriel-br2/star_wars_game/blob/main/main.py"
click node_health "https://github.com/gabriel-br2/star_wars_game/blob/main/main.py"
click node_explosions "https://github.com/gabriel-br2/star_wars_game/blob/main/main.py"
click node_graphics "https://github.com/gabriel-br2/star_wars_game/blob/main/graphics.py"
click node_assets "https://github.com/gabriel-br2/star_wars_game/tree/main/resource"

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_opening,node_menu,node_pause,node_outcome toneBlue
class node_game,node_falcon,node_asteroids,node_lasers,node_collisions,node_health,node_explosions toneAmber
class node_graphics toneMint
class node_assets toneRose
class node_player toneIndigo
```

## Components

### Intro and menus

- [Opening crawl](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py): `main.py`
- [Main menu](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py): `main.py`
- [Pause menu](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py): `main.py`
- [Win or lose](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py): `main.py`

### Gameplay systems

- [Game loop](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py): `main.py`
- [Falcon movement](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py): `main.py`
- [Asteroid field](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py): `main.py`
- [Laser firing](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py): `main.py`
- [Collision checks](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py): `main.py`
- [Ship health](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py): `main.py`
- [Hit effects](https://github.com/gabriel-br2/star_wars_game/blob/main/main.py): `main.py`

### Graphics runtime

- [Graphics primitives](https://github.com/gabriel-br2/star_wars_game/blob/main/graphics.py): `graphics.py`

### Game assets

- [Images and sprites](https://github.com/gabriel-br2/star_wars_game/tree/main/resource): `resource`

### Other components

- **Pilot**

## Connections

- Pilot → Opening crawl: starts game (evidence: `README.md`)
- Opening crawl → Main menu: continues to (evidence: `main.py`)
- Pilot → Main menu: selects options (evidence: `README.md`)
- Main menu → Game loop: starts play (evidence: `README.md`)
- Pilot → Game loop: controls (evidence: `README.md`)
- Game loop → Falcon movement: moves (evidence: `README.md`)
- Game loop → Asteroid field: faces waves (evidence: `README.md`)
- Game loop → Laser firing: fires (evidence: `README.md`)
- Game loop → Collision checks: checks hits (evidence: `main.py`)
- Collision checks → Ship health: updates (evidence: `README.md`)
- Collision checks → Hit effects: triggers effect (evidence: `main.py`)
- Game loop → Win or lose: ends in (evidence: `README.md`)
- Pilot → Pause menu: pauses play (evidence: `README.md`)
- Opening crawl → Graphics primitives: draws with (evidence: `main.py`)
- Main menu → Graphics primitives: draws with (evidence: `main.py`)
- Game loop → Graphics primitives: renders with (evidence: `main.py`)
- Opening crawl → Images and sprites: uses images (evidence: `README.md`)
- Game loop → Images and sprites: uses sprites (evidence: `README.md`)
