Reference · Controllers and canvas player
GameInfotype
What a game of the package is, for a chooser.
Import it
import type { GameInfo } from "@johnmorrisdotca/karakuri/play";
Also exported from: @johnmorrisdotca/karakuri
Definition
interface GameInfo {
id: string;
levels: number;
gesture: "drag" | "tap";
physics: boolean;
create(level: number): Controller;
}
Members
| Name | Type | Description |
|---|---|---|
id | string | |
levels | number | How many levels it has. |
gesture | "drag" | "tap" | |
physics | boolean | Whether it runs a physics simulation, stepped sixty times a second. |
create | (level: number): Controller | Builds a controller for a level (from 1). |
Examples
import type { GameInfo } from "@johnmorrisdotca/karakuri/play";
import { KARAKURI_GAMES } from "@johnmorrisdotca/karakuri/play";
const value: GameInfo = KARAKURI_GAMES["tube-sort"];
console.log(value);{
id: 'tube-sort',
levels: 5,
gesture: 'tap',
physics: false,
create: [Function: tubeSortController]
}What it prints (run when this page was built)