← back to Flappy Flight
README.md
59 lines
# Flappy Flight
A polished, self-contained **Flappy-Bird-style** game in a single HTML file.
No external assets, no libraries, no build step — just open `index.html`.
 
## Play
- **Open `index.html`** in any modern browser, or run a local server (below).
- **Flap:** `Space` · `↑` · `W` · click · tap
- **Pause:** `P` or `Esc` (also auto-pauses when the tab loses focus)
- **Mute:** `M`, or click the speaker icon (top-right)
- **Restart:** click / `Space` on the Game Over screen
Get through the pipe gaps. The game speeds up and the gaps tighten as your
score climbs. Bronze / silver / gold medals at 10 / 25 / 40. Your best score
is saved in the browser.
## Local server (optional)
The game is a plain file, but a server avoids any `file://` quirks:
```bash
npm start # serves on http://localhost:8080 (zero dependencies)
# or:
python3 -m http.server 8080
```
## Features
- Gravity + flap physics, **frame-rate independent** (delta-time integrated, clamped on tab-switch)
- Scrolling pipe gaps with **increasing difficulty** (scroll speed, gap height, spacing all ramp with score)
- **3-layer parallax** background — twinkling stars + moon, drifting clouds, two mountain ridges, scrolling ground
- Circle-vs-rect collision matched precisely to the drawn pipe geometry
- Ready / Play / Dying / Game-Over states with an animated death fall, screen-shake and flash
- **True pause** — one game-owned clock drives every animation, so a pause freezes the *entire* scene (not just the bird)
- **Mute toggle**, persisted to `localStorage` alongside the best score
- Procedural audio via the Web Audio API (flap / score / hit / swoosh) — no sound files
- Crisp on HiDPI/Retina; scales to any window while keeping a fixed play field
## Provenance
Started from Claude Opus's Model Arena artifact ("All-Models — Flappy Clone").
Kept the strong core (physics, collision, parallax, procedural audio, medals),
then fixed and extended it:
- **Bug fix:** animations were driven by raw `performance.now()`, so the sky,
clouds and parallax hills kept drifting even when the game was effectively
stopped. Replaced with a single `clock` that only advances while running —
which also made a proper pause possible.
- **Added:** pause (`P`/`Esc` + auto-pause on blur/visibility change), mute
toggle (`M` + clickable speaker icon, persisted), on-screen control hints,
and project scaffolding (dev server, README, license, git).
## License
MIT — see [LICENSE](LICENSE).