api
campaignKit's front door. `Campaign.start(config)` gives a level-based game its whole shell from one config table, on the player's own machine: menusKit title, a level-select map (`map.style`: storybook, parchment, lanterns or list), a dialogueKit story beat before and after each…
api
campaignKit's front door. Campaign.start(config) gives a level-based game its whole shell from one config table, on the player's own machine: menusKit title, a level-select map (map.style: storybook, parchment, lanterns or list), a dialogueKit story beat before and after each level, the level itself (platformer3dKit by default, or your own runner), results with Next / Retry / map, a finale hook, credits, per-player pause and settings, per-level music and jump / land / checkpoint / death sounds. Call it in play from any script (a component's update is fine: a running config is left alone).
Also: Campaign.status(), Campaign.on(evt, fn) ("state", "level", "finish", "unlock"), Campaign.go(screen, levelId), Campaign.restart(), Campaign.finished(levelId, result) for custom runners, Campaign.setMapStyle(style), Campaign.setSoundSet(set), Campaign.sting(name), Campaign.best(id), Campaign.isUnlocked(id), Campaign.catalogue(). The config's fields are listed in the package README.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2nonstrict
hostComponent( ) → string
ensureHost( ) → void
start(cfg: any, over: any?) → boolean
Start the campaign on this machine with a config (see the header). Safe to call every frame: a config already running is left as it is. `over` merges a few fields on top (e.g. { showTitle = false }).
| arg | type | description |
|---|---|---|
| cfg | any | |
| over | any? |
stop( ) → void
Stop the campaign on this machine (screens go away; the next start begins at boot).
status( ) → any return Director
The local player's campaign: { state, level, focus, mapStyle }. state is "off", "boot", "title", "select", "sendoff", "playing", "results", "finale" or "credits".
on(evt: string, fn: (any, string) → void
Listen to the campaign: "state", "level", "finish", "unlock" or "*". Returns an unsubscribe function.
| arg | type | description |
|---|---|---|
| evt | string | |
| fn | (any, string |
go(screen: string, levelId: string?) → void
Go to a screen for the local player: "title", "select" (levelId focused), "level" (levelId, with its story beat), "finale".
| arg | type | description |
|---|---|---|
| screen | string | |
| levelId | string? |
restart( ) → void
Restart the current level for the local player.
finished(levelId: string, result: any) → void
A custom runner's run ended: result = { time, tier, coins, totalCoins, deaths }.
| arg | type | description |
|---|---|---|
| levelId | string | |
| result | any |
setMapStyle(style: string) → void
Swap the level-select style on this machine: "storybook", "parchment", "lanterns" or "list".
| arg | type | description |
|---|---|---|
| style | string |
setSoundSet(set: string) → void
Swap the feedback / stinger sound set on this machine: "storybook", "cartoon", "retro", "scifi" or "none".
| arg | type | description |
|---|---|---|
| set | string |
sting(name: string, opts: any?) → void
Play one of the campaign's sounds for the local player (a set sound or one of the config's `sounds.extra`).
| arg | type | description |
|---|---|---|
| name | string | |
| opts | any? |
best(levelId: string) → any return Progress
The local player's best run of a level, or nil.
| arg | type | description |
|---|---|---|
| levelId | string |
isUnlocked(levelId: string) → boolean return Progress
Whether the local player may play a level.
| arg | type | description |
|---|---|---|
| levelId | string |
catalogue( ) → any
What every one-setting swap offers: { mapStyles, looks, medals, soundSets } with blurbs.
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.