Barrel entry documenting the @tamb/gamegrid public API.
@tamb/gamegrid
The GameGrid class is the default export. Custom grid events use IGameGridEventDetail / GameGridDOMEvent with string names from gridEventsEnum.
import GameGrid, { cellTypeEnum, gridEventsEnum } from "@tamb/gamegrid";const grid = new GameGrid( { matrix: [[{ type: cellTypeEnum.OPEN }, { type: cellTypeEnum.OPEN }]], options: { wasdControls: true }, }, document.querySelector("#root")!,);grid.moveRight();window.addEventListener(gridEventsEnum.MOVE_LAND, () => { console.log(grid.getState().activeCoords);}); Copy
import GameGrid, { cellTypeEnum, gridEventsEnum } from "@tamb/gamegrid";const grid = new GameGrid( { matrix: [[{ type: cellTypeEnum.OPEN }, { type: cellTypeEnum.OPEN }]], options: { wasdControls: true }, }, document.querySelector("#root")!,);grid.moveRight();window.addEventListener(gridEventsEnum.MOVE_LAND, () => { console.log(grid.getState().activeCoords);});
Barrel entry documenting the
@tamb/gamegridpublic API.Remarks
The GameGrid class is the default export. Custom grid events use IGameGridEventDetail / GameGridDOMEvent with string names from gridEventsEnum.
Example