2d-videogame-in-assemblyscript
2d-videogame-in-assemblyscript copied to clipboard
Demo 2D videogame in AssemblyScript 🚀
2D Video Game in AssemblyScript
A small demo 2D video game running in a web browser powered by WebAssembly.
Disclaimer: This was never intented to be a real game. The purpose is to demonstrate programming games from scratch in AssemblyScript.
📖 Read the whole tutorial on my blog.
Check out alternative technical approaches:
- Control of the game rendering loop within Wasm (blog post)
- Automatic inlining of image assets
- Rendering and game controls in a text terminal
Build
Install package
npm install
Compile to WebAssembly
npm run asbuild:optimized -- --memoryBase 40000
Run
npx ws -p 1234
Open http://127.0.0.1:1234
in a web browser.
Play
Play online at https://ttulka.github.io/breadcrumblost/
Desktop only.
Breadcrumb Lost
It is easy for children to follow breadcrumbs to get back home. But what about the poor breadcrumbs?!
Help a lost breadcrumb find its way home without getting wet or eaten.
Controls
- UP jump
- RIGHT go right
- LEFT go left
Develop
Convert images to AssemblyScript byte arrays
node image2array.js assets/image.png > assembly/assets/image.ts
Copyright
Assets taken from https://kenney.nl/assets/pixel-platformer