What it does
createBubbles adds bubbles to a platform-walker world with its enemies. A blown bubble travels a set range at a set
speed and traps the first enemy it touches, and only a travelling bubble traps, unless you allow capture while
floating. Then it floats on the level's air currents, a field with one direction character per cell, so bubbles drift
up, across and down and gather where the currents meet, wrapping through gaps on a map that wraps. A trapped enemy
stays for its trap time, flashes through warning colours, and breaks out. Touching a bubble pops it and every bubble
in contact with it, and the pop reports the trapped enemies it took, which is what chained scores are built on. A
player holding jump bounces on a bubble, so bubbles become stepping stones.
Bubbles are a surface the world knows about: they rise up through pass-through platforms from below, rest on top of them and are stopped by their sides and by solid walls. Special bubbles can rise straight up from below a floor gap to a set height before joining the currents. Letter bubbles carry a letter for bonus systems built on top.
createElements runs what special bubbles release. Water becomes a stream that falls to the floor, runs along it,
turns at walls and drops through gaps, sweeping up enemies and carrying players until it drains out of the bottom of
the map. Fire drops, spreads, burns the floor and stuns. Lightning crosses the screen in a direction. Both parts
report what happened as events and snapshot their state.
Features
- Blown bubbles — range, speed and radius, with a cap on how many exist and an optional pop against walls.
- Trapping — the first enemy a travelling bubble touches, filtered by a capture rule you supply, such as no bosses.
- Escape timing — a trap time, staged warning colours and an angry break-out.
- Chain pops — touching one bubble pops every bubble touching it, with the trapped enemies listed.
- Air currents — a per-cell field of up, right, down, left or still, read from rows of text, that wraps with the map.
- Riding — players bounce on bubbles while holding jump; set the bounce to 0 to turn it off.
- Special bubbles — empty, water, fire, lightning and letter bubbles, rising in from below a floor gap.
- Floods — water streams that sweep enemies and carry players, with optional life and wall-turn limits.
- Fire and lightning — fire that falls, spreads, burns and stuns; bolts with their own speed and size.
- Events and snapshots —
captured,escaped,popped,wrapped,element-kill,ride-startand more.
Good for
- Single-screen bubble-trapping platformers in the style of Bubble Bobble, with currents and chained pops.
- Platform games that want a capture weapon, where stunned enemies float away instead of dying outright.
- Floating-platform puzzles, where the player builds a path of bubbles to climb.
- Flood and hazard levels, using water streams that carry the player and sweep the enemies.
- Co-op platformers, with an owner on every bubble and effect so scores go to the right player.
Make it yours
Bubbles take settings for radius, shot speed and range, float speed, how long empty and special bubbles last, trap
time and warning stages, the rise speed for special bubbles, the bounce, the chain contact distance, separation, the
maximum count, wall popping and wrapping, plus the capture rule and the air-current rows. Elements take water speed,
length, step, life and turns, fire fall, spread, burn and stun, bolt speed and size, and whether a carried player can
jump out of a flood. Both change live with configure.
Two materially different uses: an arcade capture game with short-range, fast bubbles, an eight-second trap time, strong currents gathering bubbles at the top of the screen and floods that run until they drain; and a gentle puzzle platformer where bubbles never trap anything, last a long time and exist only to be ridden, on still air.
A quick look
Bubbles over a platform world, a chain popped, and a flood released:
const BT = game.bubbleTrap;
const bubbles = BT.createBubbles({ world, enemies, settings: { trapTime: 8 }, currents: rows,
canCapture: (id, kind) => kind !== 'boss' });
bubbles.blow('p1'); // travels, then floats; traps the first enemy it touches
const r = bubbles.pop(id, 'p1'); // r.enemies lists the trapped enemies the chain took
const el = BT.createElements({ world, enemies, settings: { waterLife: 2 } });
el.water(20, 10, 1); // a flood running right from (20, 10)
Works with
platform-map,platform-walkerandplatform-enemies— required: the level, the bodies and the enemies.enemy-capture— the arcade structure on top: rounds, chained scores, fruit, items and lives.bubble-cave— all 100 rounds of the classic arcade bubble game, configured for that structure.snow-roll— for snowballs instead of bubbles.
Good to know
- Bubbles do not collide with moving platforms.
- A flood is one stream of cells running along floors; it does not fill a room.
- With no life or turn limit, water in a closed pocket flows until something ends it, as in the arcade game.
- The pack draws nothing; your game draws the bubbles, currents and elements from their state.






