# saffdds/gam6 architecture

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

- Interactive diagram: https://gitdiagram.com/saffdds/gam6
- Repository: https://github.com/saffdds/gam6

## Overview

Gam6 is a Pygame arcade driving game. The main workflow is menu → difficulty selection → gameplay → game-over results, with instructions as a separate menu branch. Gameplay includes player movement, obstacle avoidance, score-based speed progression, and timed shield power-ups. The sampled source shows all runtime behavior in one file; the executable is not mapped as a source component. Links are based on calls visible in gam6.py; no separate persistence or external service is shown.

Main entry points: [`gam6.py`](https://github.com/saffdds/gam6/blob/web/gam6.py) (Game loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Menus and screens"]
  node_menu["Main menu<br/>[gam6.py]"]
  node_difficulty["Difficulty selector<br/>[gam6.py]"]
  node_instructions["Instructions screen<br/>[gam6.py]"]
  node_results["Game-over screen<br/>[gam6.py]"]
end

subgraph group_game["Driving gameplay"]
  node_game_loop["Game loop<br/>[gam6.py]"]
end

subgraph group_entities["Game entities"]
  node_player["Player<br/>[gam6.py]"]
  node_obstacles["Obstacles<br/>[gam6.py]"]
  node_powerups["Shield power-ups<br/>[gam6.py]"]
end

node_pygame["Pygame runtime"]
node_player_actor(("Player"))

node_player_actor -->|"starts game"| node_menu
node_menu -->|"opens"| node_difficulty
node_menu -->|"opens"| node_instructions
node_difficulty -->|"starts with settings"| node_game_loop
node_game_loop -->|"creates and updates"| node_player
node_game_loop -->|"spawns and manages"| node_obstacles
node_game_loop -->|"spawns and manages"| node_powerups
node_game_loop -->|"shows final score"| node_results
node_menu -->|"uses interface"| node_pygame
node_game_loop -->|"uses sprites and display"| node_pygame

click node_player "https://github.com/saffdds/gam6/blob/web/gam6.py"
click node_obstacles "https://github.com/saffdds/gam6/blob/web/gam6.py"
click node_powerups "https://github.com/saffdds/gam6/blob/web/gam6.py"
click node_menu "https://github.com/saffdds/gam6/blob/web/gam6.py"
click node_difficulty "https://github.com/saffdds/gam6/blob/web/gam6.py"
click node_instructions "https://github.com/saffdds/gam6/blob/web/gam6.py"
click node_game_loop "https://github.com/saffdds/gam6/blob/web/gam6.py"
click node_results "https://github.com/saffdds/gam6/blob/web/gam6.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_menu,node_difficulty,node_instructions,node_results toneBlue
class node_game_loop toneAmber
class node_player,node_obstacles,node_powerups toneMint
class node_pygame,node_player_actor toneIndigo
```

## Components

### Menus and screens

- [Main menu](https://github.com/saffdds/gam6/blob/web/gam6.py): `gam6.py`
- [Difficulty selector](https://github.com/saffdds/gam6/blob/web/gam6.py): `gam6.py`
- [Instructions screen](https://github.com/saffdds/gam6/blob/web/gam6.py): `gam6.py`
- [Game-over screen](https://github.com/saffdds/gam6/blob/web/gam6.py): `gam6.py`

### Driving gameplay

- [Game loop](https://github.com/saffdds/gam6/blob/web/gam6.py): `gam6.py`

### Game entities

- [Player](https://github.com/saffdds/gam6/blob/web/gam6.py): `gam6.py`
- [Obstacles](https://github.com/saffdds/gam6/blob/web/gam6.py): `gam6.py`
- [Shield power-ups](https://github.com/saffdds/gam6/blob/web/gam6.py): `gam6.py`

### Other components

- **Pygame runtime**
- **Player**

## Connections

- Player → Main menu: starts game (evidence: `README.md`)
- Main menu → Difficulty selector: opens (evidence: `gam6.py`)
- Main menu → Instructions screen: opens (evidence: `gam6.py`)
- Difficulty selector → Game loop: starts with settings (evidence: `gam6.py`)
- Game loop → Player: creates and updates (evidence: `gam6.py`)
- Game loop → Obstacles: spawns and manages (evidence: `gam6.py`)
- Game loop → Shield power-ups: spawns and manages (evidence: `gam6.py`)
- Game loop → Game-over screen: shows final score (evidence: `gam6.py`)
- Main menu → Pygame runtime: uses interface (evidence: `gam6.py`)
- Game loop → Pygame runtime: uses sprites and display (evidence: `gam6.py`)
