🥷 Try it live — no local setup. ICP Ninja is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit Deploy if you're already in Ninja. To build and run it locally instead, follow the steps below.
Flying Ninja is a 2D side-scroller game where players control a ninja character using the space bar to move up and down, dodging obstacles to earn points. When the game ends, players can submit their score to an on-chain leaderboard backed by a Rust canister on ICP.
- Node.js
- icp-cli:
npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm
git clone https://github.com/dfinity/examples
cd examples/rust/flying_ninjaicp network start -d
icp deploy
bash test.sh
icp network stopFor frontend development with hot reload:
npm run dev --prefix frontendThe backend/backend.did file defines the backend canister's public interface. The frontend TypeScript bindings are auto-generated from this file during the frontend build.
If you modify the backend's public API, rebuild the canister and regenerate the .did file:
icp build backend
candid-extractor target/wasm32-unknown-unknown/release/backend.wasm > backend/backend.didRefer to the security best practices for information on security and best practices for your ICP app.