2D game engine for teh webz
npm install myst2
myst2 is a lightweight 2D game engine for the web.
v0.0.0
> [!NOTE]
> This project is a work in progress and isn't currently usable in any way, shape or form. Grab a time machine and check back at a later time.
JavaScript
import { View, Application } from 'myst2';
// create a game view
class MyView extends View {
onDraw() {
// clear the surface
this.surface.clear();
// draw some shapes
this.render.rectFill(10, 10, 50, 50, 'orange');
this.render.circleFill(100, 100, 30, 'blue');
}
}
// create the game
class Game extends Application {
constructor() {
super({ // setup game
$canvas: document.querySelector('#my-canvas'),
useSimpleLoop: true, // just draw() and don't update()
initialView: new MyView()
});
}
}
// run the game
new Game().run();
``