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

How-to

Draw a shield or stretch an arm

Use native path coordinates, geometry limits and stored level plans.

Create native rule states

import { saveTheCharacter,stretchGrabber } from "@johnmorrisdotca/karakuri";
import { SAVE_THE_CHARACTER_LEVELS,STRETCH_GRABBER_LEVELS } from "@johnmorrisdotca/karakuri/levels";
const shield=saveTheCharacter.newSaveGame(SAVE_THE_CHARACTER_LEVELS[0]);
const arm=stretchGrabber.newGrabGame(STRETCH_GRABBER_LEVELS[0]);
console.log(shield.status,stretchGrabber.tipOf(arm),stretchGrabber.armLength(arm));
playing { x: 180, y: 452 } 0

Coordinates are in the game’s own units, not screen pixels. The native controller scales pointer input for the canvas. Save the Character builds a physical stroke after the native drawing/release rules accept it. Stretch Grabber maintains its trail, reach, solids and hazards. Stored solution/loss paths belong to their exact level.

The complete shield guide and arm guide preserve drawing limits, collisions and replay helpers. Use a finite maximum tick count for physics-based path replay.

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