wasm-asteroids
                                
                                
                                
                                    wasm-asteroids copied to clipboard
                            
                            
                            
                        Porting an asteroids game from C to WebAssembly
Asteroids
This is a WebAssembly port of an Asteroids game written in C:
Live Demo | WebAssembly Tutorial

If you're looking for a practical guide to learning WebAssembly, check out my book Level up with WebAssembly.
Build
Fetch Emscripten from DockerHub:
docker pull robertaboukhalil/emsdk:1.38.26
Create a container from that image:
# Create container from that image
docker run -dt --name wasm robertaboukhalil/emsdk:1.38.26
# Enter the container
docker exec -it wasm bash
Within the container, fetch the code:
git clone "https://github.com/robertaboukhalil/wasm-asteroids.git"
cd wasm-asteroids
And compile it to WebAssembly:
emcc \
    -o app.html asteroids/*.c \
    -Wall -g -lm \
    -s USE_SDL=2