Skip to the content

Karakuriからくり

Play eight native puzzles, run bounded searches, step deterministic physics and mount a canvas player controlled by pointer or keyboard.

Karakuri is the Japanese word からくり for a mechanism or ingenious device. About the name

Contents

Reference · Controllers and canvas player

StatusEventtype

What a status callback is given.

Import it

import type { StatusEvent } from "@johnmorrisdotca/karakuri/play";

Definition

interface StatusEvent {
    game: KarakuriGame;
    level: number;
    status: Status;
    result: Say | null;
    text: string;
    info: string;
}

Members

NameTypeDescription
game"save-the-character" | "pin-rescue" | "nuts-and-bolts" | "stretch-grabber" | "grid-escape" | "rope-cut" | "tube-sort" | "choice-story"
levelnumber
statusStatus
resultSay | null
textstring

The words of result in the player's language ("" while playing), for a page that draws its own result.

infostring

The line the bar would show about the level, in the player's language (moves made, ink left, and so on).

Examples

import { createController } from "@johnmorrisdotca/karakuri/play";
import type { StatusEvent } from "@johnmorrisdotca/karakuri/play";
import { say } from "@johnmorrisdotca/karakuri";

const controller=createController("tube-sort",1);
const value: StatusEvent = {game:"tube-sort",level:1,status:controller.status,result:controller.result,text:"",info:say("en",controller.info.key,controller.info.values)};
console.log(value);
{
  game: 'tube-sort',
  level: 1,
  status: 'playing',
  result: null,
  text: '',
  info: 'Pours 0'
}

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/karakuri 0.2.1.