# prikapoor/flappy_bird architecture

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

- Interactive diagram: https://gitdiagram.com/prikapoor/flappy_bird
- Repository: https://github.com/prikapoor/flappy_bird

## Overview

Sky Flapper is a browser-based Flappy Bird-style canvas game. The player selects settings, starts a run, steers by flapping, and sees the evolving world, score, and game state; runs can end, restart, or be paused. Major documented capabilities include themed levels, difficulty, power-ups, skins, achievements, generated sound, and saved progress. The excerpts show the animation loop, input handling, and persistence calls, but do not expose every runtime handoff, so uncertain connections are omitted.

Main entry points: [`js/main.js`](https://github.com/prikapoor/flappy_bird/blob/main/js/main.js) (Loop and setup), [`js/input.js`](https://github.com/prikapoor/flappy_bird/blob/main/js/input.js) (Input controls), [`js/features.js`](https://github.com/prikapoor/flappy_bird/blob/main/js/features.js) (Power-ups and achievements), [`js/state.js`](https://github.com/prikapoor/flappy_bird/blob/main/js/state.js) (Run state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_main["Loop and setup<br/>[main.js]"]
  node_input["Input controls<br/>[input.js]"]
  node_config["Game configuration<br/>[config.js]"]
  node_state["Run state<br/>[state.js]"]
end

subgraph group_gameplay["Gameplay"]
  node_update["Game update<br/>[update.js]"]
  node_collision["Collision checks<br/>[collision.js]"]
end

subgraph group_presentation["Presentation"]
  node_audio["Generated sound<br/>[audio.js]"]
  node_render["Canvas world rendering<br/>[render.js]"]
  node_ui["HUD and menus<br/>[ui.js]"]
end

subgraph group_progression["Progression"]
  node_features["Power-ups and achievements<br/>[features.js]"]
end

node_player(("Player"))
node_storage[("Browser localStorage")]

node_player -->|"controls"| node_input
node_main -->|"calls each frame"| node_update
node_main -->|"renders each frame"| node_render
node_main -->|"loads run settings"| node_state
node_main -->|"loads progress and skin"| node_features
node_input -->|"initializes and toggles"| node_audio
node_input -->|"changes skin and panel"| node_features
node_state -->|"reads and writes settings"| node_storage
node_features -->|"reads and writes progress"| node_storage

click node_main "https://github.com/prikapoor/flappy_bird/blob/main/js/main.js"
click node_input "https://github.com/prikapoor/flappy_bird/blob/main/js/input.js"
click node_config "https://github.com/prikapoor/flappy_bird/blob/main/js/config.js"
click node_state "https://github.com/prikapoor/flappy_bird/blob/main/js/state.js"
click node_update "https://github.com/prikapoor/flappy_bird/blob/main/js/update.js"
click node_collision "https://github.com/prikapoor/flappy_bird/blob/main/js/collision.js"
click node_features "https://github.com/prikapoor/flappy_bird/blob/main/js/features.js"
click node_audio "https://github.com/prikapoor/flappy_bird/blob/main/js/audio.js"
click node_render "https://github.com/prikapoor/flappy_bird/blob/main/js/render.js"
click node_ui "https://github.com/prikapoor/flappy_bird/blob/main/js/ui.js"

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_input,node_config,node_state toneBlue
class node_update,node_collision,node_storage toneAmber
class node_audio,node_render,node_ui toneMint
class node_features toneRose
class node_player toneIndigo
```

## Components

### Runtime

- [Loop and setup](https://github.com/prikapoor/flappy_bird/blob/main/js/main.js): `js/main.js`
- [Input controls](https://github.com/prikapoor/flappy_bird/blob/main/js/input.js): `js/input.js`
- [Game configuration](https://github.com/prikapoor/flappy_bird/blob/main/js/config.js): `js/config.js`
- [Run state](https://github.com/prikapoor/flappy_bird/blob/main/js/state.js): `js/state.js`

### Gameplay

- [Game update](https://github.com/prikapoor/flappy_bird/blob/main/js/update.js): `js/update.js`
- [Collision checks](https://github.com/prikapoor/flappy_bird/blob/main/js/collision.js): `js/collision.js`

### Presentation

- [Generated sound](https://github.com/prikapoor/flappy_bird/blob/main/js/audio.js): `js/audio.js`
- [Canvas world rendering](https://github.com/prikapoor/flappy_bird/blob/main/js/render.js): `js/render.js`
- [HUD and menus](https://github.com/prikapoor/flappy_bird/blob/main/js/ui.js): `js/ui.js`

### Progression

- [Power-ups and achievements](https://github.com/prikapoor/flappy_bird/blob/main/js/features.js): `js/features.js`

### Other components

- **Player**
- **Browser localStorage**

## Connections

- Player → Input controls: controls (evidence: `README.md`)
- Loop and setup → Game update: calls each frame (evidence: `js/main.js`)
- Loop and setup → Canvas world rendering: renders each frame (evidence: `js/main.js`)
- Loop and setup → Run state: loads run settings (evidence: `js/main.js`)
- Loop and setup → Power-ups and achievements: loads progress and skin (evidence: `js/main.js`)
- Input controls → Generated sound: initializes and toggles (evidence: `js/input.js`)
- Input controls → Power-ups and achievements: changes skin and panel (evidence: `js/input.js`)
- Run state → Browser localStorage: reads and writes settings (evidence: `js/state.js`)
- Power-ups and achievements → Browser localStorage: reads and writes progress (evidence: `js/features.js`)
