A complete, lightweight Flappy Bird style game written in Rust with macroquad. The game includes gravity and flap input, moving pipes, collision detection, scoring, game over, and restart, plus modern extras like a pixel-art paper plane, audio cues, collectibles, combo/flow bonuses, and temporary power-ups.
Requirements:
- Rust toolchain (stable)
- Linux native builds/runs with audio: ALSA development headers
Ubuntu/Debian:
sudo apt-get install libasound2-devRun the game:
cargo runBuild WebAssembly (for web):
rustup target add wasm32-unknown-unknown
cargo build --release --target wasm32-unknown-unknownRun tests:
cargo testUnit tests cover pure helper logic and do not require the native audio backend.
Validate build in headless environments:
cargo checkPreview the web build locally:
mkdir -p dist
cp web/index.html dist/index.html
cp target/wasm32-unknown-unknown/release/flappy_rust.wasm dist/flappy_rust.wasm
python3 -m http.server 8080 -d distSpace/Up Arrow/ Left Mouse Button: Start + flapR: Restart after game overP: Pause / resumeM: Mute / unmute audio
- Pixel-art paper plane keeps a right-facing nose, pitches with vertical velocity, and leaves a trailing wake.
- Retro chiptune BGM (looped) plus runtime flap/score/game-over SFX.
- Pixel-art pipes with segmented caps, shading, and highlights.
- Pause/resume and mute toggles with in-game HUD hints.
- Collectibles: stars (combo scoring), feathers (low gravity), shields (one-hit protection), boost orbs (score multiplier).
- Flow system: perfect gap passes build Flow for bonus points; close calls score extra.
- Persistent high score, end-run medals, and new-best callouts.
- Score popups, particle bursts, and impact flashes for stronger feedback.
- Modern visuals: sky day/night cycle, parallax ground, clouds, and boost speed lines.
- License: MIT
- CI/CD deploy:
.github/workflows/deploy-pages.yml
- Create a GitHub repository and push this project to branch
main. - In repository settings, open
Pagesand ensure source usesGitHub Actions. - Keep workflow file at
.github/workflows/deploy-pages.yml. - Push to
main(or runworkflow_dispatch) to publish. - Live demo URL:
https://fred-vu.github.io/flappy-rust/
src/main.rs: Window configuration and the main game loop.src/game.rs: Game state, update loop, rendering, and pipe spawning logic.src/physics.rs: Pure helper functions (collision detection, clamp) with unit tests.
Gameplay state is centralized in Game, keeping the update/draw responsibilities explicit and deterministic. Physics helpers stay isolated for easier testing without rendering.
