This is a simple snake game written in rust using wasm.
Use the arrow keys to move the snake around the screen. The snake will grow when it eats the food. The game ends when the snake collides with the walls or itself.
Before you can run the project, you need to install wasm-pack
.
Then you can build the project by running:
cargo build --target wasm32-unknown-unknown --release
After that, you need to generate the files about the wasm module by running:
wasm-bindgen --out-dir /static/out --target web ./target/wasm32-unknown-unknown/release/snake.wasm
Finally, you can run the project by running:
(Ensuring you have set a python environment with requirements.txt
installed)
python app.py
Enjoy the game!
There is a Dockerfile
that you can use to deploy the project.
There is also a captain-definition
file that you can use to deploy the project on CapRover.