# edds018/galaxy-rush architecture

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

- Interactive diagram: https://gitdiagram.com/edds018/galaxy-rush
- Repository: https://github.com/edds018/galaxy-rush

## Overview

Galaxy Rush is a single-file SDL2 arcade game: the player controls Shion, fights increasingly difficult enemies, and earns points across game phases. The principal workflow is keyboard/event handling during a phase, movement and shooting, enemy-hit resolution, and score updates. These responsibilities are implemented together in Galaxy/v2.c rather than separate modules. The excerpts show phase event polling, bullet setup and firing, enemy movement and hit handling, and explosion playback; the README supplies the game premise and SDL runtime requirements. Other internal boundaries are inferred from the monolithic file, not inspected in full.

Main entry points: [`Galaxy/v2.c`](https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c) (Bullets and hits), [`Galaxy/explosao.wav`](https://github.com/edds018/galaxy-rush/blob/master/Galaxy/explosao.wav) (Explosion sound)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Gameplay"]
  node_player["Player controls<br/>[v2.c]"]
  node_phases["Game phases<br/>[v2.c]"]
  node_enemies["Enemy behavior<br/>[v2.c]"]
  node_combat["Bullets and hits<br/>[v2.c]"]
  node_scoring["Score updates<br/>[v2.c]"]
end

subgraph group_runtime["SDL Runtime"]
  node_eventloop["SDL event loop<br/>[v2.c]"]
  node_audio["Sound playback<br/>[v2.c]"]
end

subgraph group_assets["Game Assets"]
  node_explosion["Explosion sound<br/>[explosao.wav]"]
end

node_playeractor(("Player"))

node_playeractor -->|"provides input"| node_eventloop
node_eventloop -->|"dispatches events"| node_phases
node_phases -->|"moves enemies"| node_enemies
node_phases -->|"handles firing"| node_combat
node_combat -->|"checks hits"| node_enemies
node_combat -->|"awards points"| node_scoring
node_combat -->|"plays effect"| node_audio
node_audio -.->|"uses sound"| node_explosion

click node_player "https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c"
click node_phases "https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c"
click node_enemies "https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c"
click node_combat "https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c"
click node_scoring "https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c"
click node_eventloop "https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c"
click node_audio "https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c"
click node_explosion "https://github.com/edds018/galaxy-rush/blob/master/Galaxy/explosao.wav"

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_phases,node_enemies,node_combat,node_scoring toneBlue
class node_eventloop,node_audio toneAmber
class node_explosion toneMint
class node_playeractor toneIndigo
```

## Components

### Gameplay

- [Player controls](https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c): `Galaxy/v2.c`
- [Game phases](https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c): `Galaxy/v2.c`
- [Enemy behavior](https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c): `Galaxy/v2.c`
- [Bullets and hits](https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c): `Galaxy/v2.c`
- [Score updates](https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c): `Galaxy/v2.c`

### SDL Runtime

- [SDL event loop](https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c): `Galaxy/v2.c`
- [Sound playback](https://github.com/edds018/galaxy-rush/blob/master/Galaxy/v2.c): `Galaxy/v2.c`

### Game Assets

- [Explosion sound](https://github.com/edds018/galaxy-rush/blob/master/Galaxy/explosao.wav): `Galaxy/explosao.wav`

### Other components

- **Player**

## Connections

- Player → SDL event loop: provides input (evidence: `Galaxy/v2.c`)
- SDL event loop → Game phases: dispatches events (evidence: `Galaxy/v2.c`)
- Game phases → Enemy behavior: moves enemies (evidence: `Galaxy/v2.c`)
- Game phases → Bullets and hits: handles firing (evidence: `Galaxy/v2.c`)
- Bullets and hits → Enemy behavior: checks hits (evidence: `Galaxy/v2.c`)
- Bullets and hits → Score updates: awards points (evidence: `Galaxy/v2.c`)
- Bullets and hits → Sound playback: plays effect (evidence: `Galaxy/v2.c`)
- Sound playback → Explosion sound: uses sound
