A small desktop Flappy Bird–style endless runner written in Rust with Macroquad.
From this directory:
cargo run --releaseControls: Space or left click to flap. Start from the title screen, retry after game over. Escape quits.
Run cargo run from the project root so paths like assets/bg.png resolve.
Put images in assets/ (not the repo root):
| File | Role |
|---|---|
assets/bg.png |
Full-screen background inside the play area |
assets/frame-1.png … assets/frame-8.png |
Bird animation (cycled while playing / on the title screen) |
If any of these fail to load, the game uses the built-in sky color and vector bird. If your bird faces the wrong way, set flip_x to true in the draw_bird_sprite call in src/main.rs.
Your best score is stored as JSON on disk:
- Linux:
~/.local/share/flappy_rust/highscore.json - macOS:
~/Library/Application Support/flappy_rust/highscore.json - Windows:
%LOCALAPPDATA%\flappy_rust\highscore.json
If you hit permission errors when running cargo build (for example on a shared machine), you can use a local Cargo cache:
mkdir -p .cargo_home
CARGO_HOME=$PWD/.cargo_home cargo build --releaseThe workflow .github/workflows/pages.yml builds wasm32-unknown-unknown, copies web/index.html, flappy_rust.wasm, and assets/ into a static site, and deploys it with GitHub Actions → Pages.
One-time repo setup
- On GitHub: Settings → Pages → Build and deployment → Source: choose GitHub Actions (not “Deploy from a branch”).
- Push to
main; check Actions for the “Deploy Pages” run. The site URL will be
https://<user>.github.io/<repo>/
(for examplehttps://curious-keeper.github.io/flappy-rust/).
High score in the browser uses localStorage via web/storage_plugin.js and Miniquad’s miniquad_add_plugin API. Do not use web-sys / wasm-bindgen for saves: Macroquad’s loader (mq_js_bundle.js) is not compatible with wasm-bindgen imports (black screen / instantiate errors).
Try WASM locally (static server; same folder must include storage_plugin.js):
rustup target add wasm32-unknown-unknown
cargo build --release --target wasm32-unknown-unknown
mkdir -p site
cp target/wasm32-unknown-unknown/release/flappy_rust.wasm site/
cp web/index.html site/
cp web/mq_js_bundle.js site/
cp web/storage_plugin.js site/
cp -r assets site/
cd site && python -m http.server 8080Open http://localhost:8080/. See also Macroquad WASM notes.