Skip to content

Add a power-up (double jump)

A pickup whose rule changes the player’s controller. No code needed.

{
"schemaVersion": "0.1",
"id": "feather",
"components": {
"Transform": {},
"Sprite": { "texture": "sprite.items", "frame": 4, "tint": "#c8f0ff", "z": 15 },
"Collider": { "w": 10, "h": 10, "offsetX": 3, "offsetY": 3, "trigger": true, "layer": "pickup", "mask": ["player"] },
"Pickup": { "kind": "feather", "effectColor": "#c8f0ff" },
"Hover": { "rangeX": 0, "rangeY": 2, "bobPeriod": 1 }
}
}
[
{
"on": "pickup:feather",
"do": [
{ "action": "setComponent", "entity": "player", "component": "PlatformerController", "values": { "maxJumps": 2 } },
{ "action": "banner", "text": "DOUBLE JUMP!", "durationMs": 1200, "size": 8 },
{ "action": "playSound", "sound": "sfx.checkpoint" }
]
}
]

Prove it: run the level, touch the feather, then press jump twice in the air and count jumps: watch: ["controller:jump"] should report 2 jumps for one take-off.