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 · Native level collections

SaveEntrytype

A level and the stroke that wins it (points, drawn in order) and a stroke that loses it.

Import it

import type { SaveEntry } from "@johnmorrisdotca/karakuri/levels";

Definition

interface SaveEntry extends SaveLevel {
    solution: readonly {
        x: number;
        y: number;
    }[];
    loss: readonly {
        x: number;
        y: number;
    }[];
}

Members

NameTypeDescription
solutionreadonly { x: number; y: number; }[]
lossreadonly { x: number; y: number; }[]
ledgesreadonly Ledge[]
heroPt
dangersreadonly Danger[]
inknumber

The longest the stroke may be, in units.

Examples

import type { SaveEntry } from "@johnmorrisdotca/karakuri/levels";
import { SAVE_THE_CHARACTER_LEVELS } from "@johnmorrisdotca/karakuri/levels";

const value: SaveEntry = SAVE_THE_CHARACTER_LEVELS[0];
console.log(value);
{
  ledges: [ { ax: 14, ay: 440, bx: 346, by: 440 } ],
  hero: { x: 200, y: 421 },
  dangers: [
    { kind: 'bee', x: 30, y: 415, at: 0 },
    { kind: 'bee', x: 40, y: 395, at: 14 },
    { kind: 'bee', x: 30, y: 370, at: 28 }
  ],
  ink: 380,
  solution: [
    { x: 155, y: 432 }, { x: 161, y: 417 },
    { x: 167, y: 404 }, { x: 173, y: 393 },
    { x: 179, y: 383 }, { x: 186, y: 375 },
    { x: 192, y: 369 }, { x: 198, y: 365 },
    { x: 204, y: 362 }, { x: 210, y: 362 },
    { x: 216, y: 362 }, { x: 222, y: 365 },
    { x: 228, y: 369 }, { x: 234, y: 375 },
    { x: 241, y: 383 }, { x: 247, y: 393 },
    { x: 253, y: 404 }, { x: 259, y: 417 },
    { x: 265, y: 432 }
  ],
  loss: [ { x: 60, y: 200 }, { x: 110, y: 200 } ]
}

What it prints (run when this page was built)

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