50 lines
898 B
Markdown
50 lines
898 B
Markdown
# Building Flappy Bird for Web
|
|
|
|
## Prerequisites
|
|
|
|
1. Install the WebAssembly target:
|
|
```bash
|
|
rustup target add wasm32-unknown-unknown
|
|
```
|
|
|
|
2. Install wasm-bindgen-cli (will be done automatically by build script):
|
|
```bash
|
|
cargo install wasm-bindgen-cli
|
|
```
|
|
|
|
## Building
|
|
|
|
Run the build script:
|
|
```bash
|
|
./build-web.sh
|
|
```
|
|
|
|
This will:
|
|
- Build the WASM binary
|
|
- Generate JavaScript bindings
|
|
- Copy assets to the `web/` directory
|
|
- Copy the HTML file
|
|
|
|
## Running Locally
|
|
|
|
Serve the web directory with any HTTP server:
|
|
|
|
**Python:**
|
|
```bash
|
|
python3 -m http.server --directory web 8080
|
|
```
|
|
|
|
**Alternative (if you have basic-http-server):**
|
|
```bash
|
|
cargo install basic-http-server
|
|
basic-http-server web
|
|
```
|
|
|
|
Then open http://localhost:8080 in your browser!
|
|
|
|
## Notes
|
|
|
|
- The game uses WebGL2 for rendering
|
|
- All assets are included in the build
|
|
- Image sampling is set to nearest neighbor for crisp pixel art
|