What it does
Every enemy is a platform-walker body, and the director is a walker controller that sets their intents each step.
That means enemies fall, climb ladders, hang from bars and ride moving platforms exactly as the player does, with no
second movement system to keep in step. A kind is a walker profile plus a way of moving and any modifiers you add, so
a new enemy is usually a few lines of configuration.
Pursuers plan over the level's floors, ladders, bars and drops, using the shortest route, a row scan in the manner of classic guards, a greedy step toward the target, or a guard decision rebuilt from the 1983 ladder-and-brick game's algorithm. Wanderers take ladders by chance and lean toward a target, barrels roll off ends and reverse, take ladders by chance and steer toward a target below, and a skill below 1 mixes wandering into a chaser so it is beatable.
Spawning and recycling are covered too. Emitters fire from pipes, drums and throwers by sequence or weighted kinds,
on a fixed or cycling timing table, with caps on live and total enemies. Exits swallow an enemy that walks into a zone
and return it from an emitter after a delay. A game decides what touching, trapping or kicking an enemy means; the
director reports events and obeys calls such as hit, bump, pow, suspend, resume and remove.
Features
- Patrol — turn at walls or edges or walk off them, with a chance to turn at random.
- Ladder-aware pursuit —
path,scan,greedyandlode-runnerstrategies, with climbing, hanging, drops, a maximum fall, re-planning and a fallback when the target is out of reach. - Wander and roll — wanderers that take ladders with a bias toward a target, and barrels that roll, reverse, take ladders, steer and plunge through floors.
- Hops, jumps and flight — hoppers, enemies that jump up through one-way floors toward a higher target, and a diagonal ricochet flyer that bounces or wraps at the sides.
- Flip and recover — enemies flipped by hits or floor bumps that recover after a time, angrier and faster, plus a speed-up for the last enemy left.
- Emitters and exits — pipes, drums and throwers with sequences, weighted kinds, timing tables, caps and manual firing, and exit zones that return enemies after a delay.
- Preset kinds —
barrelKind,fireballKind,shellcreeperKind,sidestepperKind,fighterFlyKind,bubbleWalkerKind,bouncerKind,guardKind,alienKind,patrollerKindandchaserKind, all editable data. - Custom behaviours — register a
thinkfunction by name, with seeded randomness and serialisable memory that snapshots capture. - Suspend and resume — hold an enemy inside a bubble, a snowball or a dug hole and release it later.
- Deterministic — seeded randomness, events through
drain, and snapshot and restore.
Good for
- Ladder-and-girder games in the style of Donkey Kong, with barrels from a thrower and wandering fireballs.
- Pipe-and-bump games in the style of Mario Bros, where bumping a floor flips enemies and pipes return them.
- Trap-and-pop games in the style of Bubble Bobble or Snow Bros, where enemies are suspended inside bubbles or snowballs and escape angrier.
- Dig-and-chase puzzles in the style of Lode Runner, with guards that chase across ladders and bars and fall into holes.
- Dig-a-hole platformers in the style of Space Panic, with aliens wandering a ladder maze.
- Your own platform levels, mixing patrollers, a ladder-chasing robot and barrels from a drum on one map.
Make it yours
createEnemies takes the walker world, the kinds, emitters, exits, targets, a seed and any custom behaviours. Each
kind sets its profile and movement and adds the modifiers it needs: hop timing, jump-up rows and chance, stun hits and
recovery time, anger and speed-up per recovery, a lone-enemy speed factor and tags. The preset kinds take a tile size,
a speed and their own knobs, such as how often a barrel takes a ladder.
The same director suits very different games. A girder level with a thrower emitting barrels on a two-and-a-half to
three-and-a-half second table, a third of them taking ladders, is one configuration. A brick maze with a handful of
guards using the lode-runner decision, suspended in holes by a dig rule and resumed when they climb out, is another.
A custom level can mix patrollers, a ladder-chasing robot, barrels from a drum and a flip-and-recover creature on
moving platforms.
A quick look
Barrels from a thrower, fireballs, a guard and a crab, with an exit pipe:
const E = game.platformEnemies;
const enemies = E.createEnemies({
world, seed: 7, targets: ['player'],
kinds: { barrel: E.barrelKind({ ladderChance: 0.3 }), fire: E.fireballKind(), guard: E.guardKind(), crab: E.sidestepperKind() },
emitters: [{ id: 'kong', points: [{ x: 24, feet: 40, facing: 1 }], kinds: [{ kind: 'barrel', weight: 1 }], every: [2.5, 3.5], max: 6 }],
exits: [{ id: 'pipe-l', zone: { x: 0, y: 200, w: 16, h: 16 }, to: 'pipes', delay: 1 }],
});
enemies.spawn('guard', { x: 120, feet: 64 });
enemies.bump(col, row); // flip what stands on a bumped cell
Works with
platform-walker— required: enemies are its bodies, with its profiles, speeds, stuns and knocks.platform-map— required: routes for pursuit and cell tests for scans and bumps.platform-movers— enemies ride lifts and belts like the player.platform-rounds— floor bumps, POW, kicks, pipes and thrower timing tables in a full round.enemy-capture— suspend an enemy inside a bubble or snowball and resume it on escape.dig-trap— suspend guards in dug holes and respawn them.platformer-2d— for physics traversal courses without enemy AI.
Good to know
- The director does not decide deaths, scores, captures or round ends; your game or the rule packs do.
- Pursuit routes are planned on the cell grid and ignore moving surfaces; they are re-planned on a timer and when the map changes.
- The
scanstrategy follows the idea of classic guard scanning but not its exact tie-breaking; uselode-runnerfor the rebuilt 1983 decision. - Preset speeds, recovery times and ladder chances are estimates from play and published rules.






