A game engine written in TypeScript and transpiled to JavaScript. It includes features that allow you to create games directly from the browser in a simple and easy way, thanks to the flexibility to modify or scale the source code.
You can see the official documentation in @cristianrg/game_engine
To install it in your project, use:
npm
npm i -D @cristianrg/game_engine
pnpm
pnpm add -D @cristianrg/game_engine
Here is a quick and simple example using TypeScript on how to use it in your project:
import { Engine, Entity, Transform, Renderable, Entities, GlobalState }
from "@cristianrg/game_engine";
const canvas = document.querySelector('canvas') as HTMLCanvasElement;
const engine = new Engine(canvas);
const scene = GlobalState.getInstance().currentScene!;
const entity = new Entity().addComponent(new Transform(50, 50, 100, 200))
.addComponent(new Renderable("red"));
scene.addComponent(new Entities());
scene.getComponent(Entities)!.addEntity(entity);
engine.start();