The TypeScript Micro 2D Game Engine: Small and lightweight 2D framework for creating browser based games.
The aim of this project is to provide a fast, micro and lightweight 2D framework for creating browser based games.
It’s fast and really simple.
Gejmko can be installed with npm.
npm install gejmko
There is no default export. The correct way to import Gejmko is:
import * as Gejmko from 'gejmko'
Want to be part of the Gejmko project? Perfect! All are welcome!
Whether you find a bug, have a great feature request feel free to get in touch.
Make sure to read the Contributing Guide
before submitting changes.
import * as Gejmko from '@gejmko/framework';
const viewport = new Gejmko.Viewport('game-id-element');
viewport.init();
viewport.changeSize(300, 300);
viewport.changeBorder(new Gejmko.Border(1, 'black', 'solid'));
const game = new Gejmko.Game(viewport);
game.start();
class Circle extends Gejmko.AbstractEntity {
x = 100;
y = 75;
render(): void {
this.context.beginPath();
this.context.arc(this.x, this.y, 50, 0, 2 * Math.PI);
this.context.stroke();
}
update(): void {
if (this.x - 50 >= 305) {
this.x = -55;
return;
}
this.x += 1;
}
}
class MarioSprite extends Gejmko.Sprite {
constructor() {
super('assets/mario-sprite.png', 2, 16, 18, 3, 0, 0, 1);
}
update(): void {
if (this.currentFrameNumber % 20 !== 0) {
return;
}
super.update();
}
}
game.addEntity(new MarioSprite());
game.addEntity(new Circle());
Build the source, run:
npm run build
This content is released under the (http://opensource.org/licenses/MIT) MIT License.