Skip to documentation
CranberryClock.Ideas / Systems / Design

INDEPENDENT TOOL / v0.1.0

TempoIntegration guide

Install Tempo, connect it to your project, and understand the integration boundaries.

Start with the package archive.

Download Tempo v0.1.0 ↓, then follow the installation instructions below. Commands that pack source files run from the public repository checkout.

Install

Download cranberry-forge-tempo-0.1.0.tgz from Cranberry Forge, then:

bash
npm install ./cranberry-forge-tempo-0.1.0.tgz
javascript
import { Tempo } from "@cranberry-forge/tempo";

const tempo = new Tempo(
  [
    { id: "dash", charges: 3, recharge: 2, cooldown: 0.15 },
    { id: "heal", charges: 2, recharge: 6, usesGlobalCooldown: false },
  ],
  { globalCooldown: 0.4 },
);

const result = tempo.tryUse("dash");
if (result.ok) startDash();

// Your existing game loop owns the clock, in seconds.
const events = tempo.tick(dt);
const hud = tempo.inspect("dash");

The browser can also import index.js directly by relative URL; the package has no imports. TypeScript declarations ship with the archive. Modern runtimes must support private class fields, structuredClone and Object.hasOwn.

View versioned source on GitHub ↗