Hazards and counter-abilities in a speedrun platformer
game-designhazardsabilitiesplatformerlevel-design
A small, reusable design for hostile elements in a non-combat platformer: each hazard type has exactly one ability that counters it, so levels can be built around intentional pairings. Designed and shipped in Run (v0.8.51-0.8.54).
Vocabulary matters
Call them hazards and abilities, never enemies and weapons. Combat words set the wrong expectations for a speedrun game: these are obstacles to route around and movement tools, not targets. (Justin's explicit convention, applied to code names, UI, and conversation.)
The three hazards
- Chaser: idle until the player enters a trigger radius (150), then chases (120 px/s). On contact it sticks and multiplies speed by a penalty (0.5x); several stack multiplicatively. Shake off all chasers with 4 dashes/jumps while stuck. Non-lethal, costs time: a good speedrun hazard.
- Turret: stationary, fires every 2 s in 8 directions; optional player tracking (turns to the player's cardinal direction); multi-side firing via a bitmask (L=1, R=2, U=4, D=8). Its body is standable (non-lethal); projectiles kill instantly and are destroyed by platforms.
- Swooper: travels along an axis at a set speed while oscillating as a sine wave (amplitude 80, frequency 0.5, speed 60; speed 0 = stationary bobbing). Lethal on contact. A patrol walker was cut: a hazard platform on a motion path already does the same thing. Don't add an entity type that existing pieces can express.
The three abilities, one per hazard
- Spike strip -> chasers: dropped at the feet, kills chasers that touch it, fades after 5 s.
- Shield -> turret projectiles: a timed bubble (default 3 s), so it is a timing skill, not a free pass.
- Laser -> swoopers: auto-targets the nearest swooper in the facing direction whose sine band contains the player's height. With no valid target it does not fire and is not consumed.
Rules: hold one at a time (a new pickup replaces it), single use, lost on death without exception, one activation key (Ctrl / an on-screen button). Acquire by free pickup or by buying with coins mid-run (number keys 1-9 map to shop slots; a small HUD shows the held ability and affordable slots).
Why the pairing works
Each ability is useless without its hazard, so placing an ability is a level-design statement ("there is a turret gauntlet ahead"). Limited, choosable abilities add resource management, one of the challenge types that deepen routing (Speedrun platformer level design).
Implementation lessons
- Avoid circular imports between player and hazard with callbacks
(
player.attachChaser(penalty, onDetach:)). - Collision types: the spike strip and chaser were both passive, and Flame never tests passive-passive pairs, so the strip silently never worked until made active (Flame engine architecture and gotchas).
- Distinguish a silent clear on death from a "shake-off" detach that plays gore/feedback.
- Spawned pickups must be tracked for removal on respawn or they duplicate each death.
- Each hazard gets a theme sprite slot so themes can reskin it.
- Deferred idea: a "mirror ghost" hazard that replays the player's own movement after a delay.