# kwoneunwoo/air-battle architecture

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

- Interactive diagram: https://gitdiagram.com/kwoneunwoo/air-battle
- Repository: https://github.com/kwoneunwoo/air-battle

## Overview

Air Battle is a Pygame arcade shooter. The player starts a run, optionally changes settings, steers a fighter and fires at an incoming missile, then sees score, playtime, and accuracy on the ending screen and can restart. The sampled code shows the main loop dispatching screens and passing run results; screens use shared image/button primitives and configuration. The README documents controls and settings; major source excerpts are available for the central loop, gameplay, start, settings, ending, and image/button helpers.

Main entry points: [`screens/setting.py`](https://github.com/kwoneunwoo/air-battle/blob/main/screens/setting.py) (Settings screen), [`main.py`](https://github.com/kwoneunwoo/air-battle/blob/main/main.py) (Application loop), [`screens/game.py`](https://github.com/kwoneunwoo/air-battle/blob/main/screens/game.py) (Gameplay), [`screens/start.py`](https://github.com/kwoneunwoo/air-battle/blob/main/screens/start.py) (Start screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flow["Game flow"]
  node_main["Application loop<br/>[main.py]"]
  node_ending["Ending screen<br/>[ending.py]"]
end

subgraph group_play["Arcade gameplay"]
  node_game["Gameplay<br/>[game.py]"]
end

subgraph group_ui["Screens and settings"]
  node_start["Start screen<br/>[start.py]"]
  node_settings["Settings screen<br/>[setting.py]"]
end

subgraph group_shared["Shared runtime"]
  node_config["Game configuration<br/>[config.py]"]
  node_image["Image rendering<br/>[image.py]"]
  node_image_button["Image button<br/>[image_button.py]"]
  node_toggle["Toggle control<br/>[toggle_button.py]"]
  node_int_button["Numeric control<br/>[int_button.py]"]
end

node_player(("Player"))
node_pygame["Pygame runtime"]
node_web["Web browser"]

node_player -->|"starts or configures"| node_start
node_main -->|"runs"| node_start
node_main -->|"runs on request"| node_settings
node_main -->|"runs"| node_game
node_main -->|"runs with results"| node_ending
node_start -->|"accepts controls"| node_player
node_start -->|"opens project link"| node_web
node_settings -->|"applies settings"| node_player
node_settings -->|"updates values"| node_config
node_settings -->|"uses"| node_image_button
node_settings -->|"uses"| node_toggle
node_settings -->|"uses"| node_int_button
node_game -->|"reads settings"| node_config
node_game -->|"renders game assets"| node_image
node_game -->|"supplies run results"| node_ending
node_ending -->|"offers restart or exit"| node_player
node_start -->|"uses"| node_image_button
node_image_button -->|"inherits rendering"| node_image
node_image -->|"loads and draws images"| node_pygame
node_main -->|"initializes runtime"| node_pygame
node_settings -->|"handles events and audio"| node_pygame
node_game -->|"handles gameplay events"| node_pygame
node_ending -->|"handles ending events"| node_pygame

click node_main "https://github.com/kwoneunwoo/air-battle/blob/main/main.py"
click node_start "https://github.com/kwoneunwoo/air-battle/blob/main/screens/start.py"
click node_settings "https://github.com/kwoneunwoo/air-battle/blob/main/screens/setting.py"
click node_game "https://github.com/kwoneunwoo/air-battle/blob/main/screens/game.py"
click node_ending "https://github.com/kwoneunwoo/air-battle/blob/main/screens/ending.py"
click node_config "https://github.com/kwoneunwoo/air-battle/blob/main/config.py"
click node_image "https://github.com/kwoneunwoo/air-battle/blob/main/objects/image.py"
click node_image_button "https://github.com/kwoneunwoo/air-battle/blob/main/objects/image_button.py"
click node_toggle "https://github.com/kwoneunwoo/air-battle/blob/main/objects/toggle_button.py"
click node_int_button "https://github.com/kwoneunwoo/air-battle/blob/main/objects/int_button.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_main,node_ending,node_web toneBlue
class node_game toneAmber
class node_start,node_settings toneMint
class node_config,node_image,node_image_button,node_toggle,node_int_button toneRose
class node_player,node_pygame toneIndigo
```

## Components

### Game flow

- [Application loop](https://github.com/kwoneunwoo/air-battle/blob/main/main.py): `main.py`
- [Ending screen](https://github.com/kwoneunwoo/air-battle/blob/main/screens/ending.py): `screens/ending.py`

### Arcade gameplay

- [Gameplay](https://github.com/kwoneunwoo/air-battle/blob/main/screens/game.py): `screens/game.py`

### Screens and settings

- [Start screen](https://github.com/kwoneunwoo/air-battle/blob/main/screens/start.py): `screens/start.py`
- [Settings screen](https://github.com/kwoneunwoo/air-battle/blob/main/screens/setting.py): `screens/setting.py`

### Shared runtime

- [Game configuration](https://github.com/kwoneunwoo/air-battle/blob/main/config.py): `config.py`
- [Image rendering](https://github.com/kwoneunwoo/air-battle/blob/main/objects/image.py): `objects/image.py`
- [Image button](https://github.com/kwoneunwoo/air-battle/blob/main/objects/image_button.py): `objects/image_button.py`
- [Toggle control](https://github.com/kwoneunwoo/air-battle/blob/main/objects/toggle_button.py): `objects/toggle_button.py`
- [Numeric control](https://github.com/kwoneunwoo/air-battle/blob/main/objects/int_button.py): `objects/int_button.py`

### Other components

- **Player**
- **Pygame runtime**
- **Web browser**

## Connections

- Player → Start screen: starts or configures (evidence: `README.md`)
- Application loop → Start screen: runs (evidence: `main.py`)
- Application loop → Settings screen: runs on request (evidence: `main.py`)
- Application loop → Gameplay: runs (evidence: `main.py`)
- Application loop → Ending screen: runs with results (evidence: `main.py`)
- Start screen → Player: accepts controls (evidence: `README.md`)
- Start screen → Web browser: opens project link (evidence: `screens/start.py`)
- Settings screen → Player: applies settings (evidence: `README.md`)
- Settings screen → Game configuration: updates values (evidence: `screens/setting.py`)
- Settings screen → Image button: uses (evidence: `screens/setting.py`)
- Settings screen → Toggle control: uses (evidence: `screens/setting.py`)
- Settings screen → Numeric control: uses (evidence: `screens/setting.py`)
- Gameplay → Game configuration: reads settings (evidence: `screens/game.py`)
- Gameplay → Image rendering: renders game assets (evidence: `screens/game.py`)
- Gameplay → Ending screen: supplies run results
- Ending screen → Player: offers restart or exit (evidence: `README.md`)
- Start screen → Image button: uses (evidence: `screens/start.py`)
- Image button → Image rendering: inherits rendering (evidence: `objects/image_button.py`)
- Image rendering → Pygame runtime: loads and draws images (evidence: `objects/image.py`)
- Application loop → Pygame runtime: initializes runtime (evidence: `main.py`)
- Settings screen → Pygame runtime: handles events and audio (evidence: `screens/setting.py`)
- Gameplay → Pygame runtime: handles gameplay events (evidence: `screens/game.py`)
- Ending screen → Pygame runtime: handles ending events (evidence: `screens/ending.py`)
