Build log · Games
How I built Dungeon Dan
A Dangerous Dave-style platformer with a harpoon gun, flooded vaults and an air meter

1.Why I built it
Dungeon Dan is my take on Dangerous Dave, the 1990 DOS platformer. The rules are the same: find the trophy, then reach the door, and avoid the fire and spikes on the way. The sprite prompts in my generator script name Dangerous Dave directly as the style target.
What I added is water. Some levels are flooded vaults, so movement changes when you go under, and an air meter means you have to plan a route between air pockets. Two guns change how levels play: a pistol, and a harpoon gun that pierces enemies and keeps working underwater.
2.How it works
Levels as character grids
A level is a grid of characters on 32 px tiles: # for solid, ^ for spikes, F for fire, g for gems, T for the trophy, E for the exit, plus pickups and enemy markers. A water mask is stored separately as a boolean grid, so a tile can be both water and empty. I write levels with a small builder class that has rect, put, pit and water helpers, which means a level's width can never drift out of sync between rows.
When a level loads, the builder strips enemy and start markers out of the grid and turns them into an entity list, so the simulation only sees terrain.
Seventeen levels from a seeded generator
The first three levels are hand-built. Levels 4 to 20 come from a generator that strings together segments copied from patterns I already knew were playable in those three: 3-wide pits, 2-wide fire, platform stairs, flat runs and flooded tunnels with air pockets. Each level seeds a Mulberry32-style PRNG with 7919 * (i + 3), so the same index always produces the same layout.
Difficulty comes from the level index. Later levels have more segments and higher enemy density, and the theme cycles through dungeon, sea and keep, which sets how likely water segments are. The trophy always sits on a stairs segment about 60% of the way through, and a fire strip always guards the exit.
Two movement models, one player
On land the player has fast acceleration, gravity of 0.5 px per frame squared, six frames of coyote time and a variable-height jump that cuts upward speed when you let go. In water everything is damped: horizontal steering is slower, sinking is capped at 1.5 px per frame, holding jump swims upward, and pressing jump at the surface gives a strong hop out.
Air drains only while the player's head is under water and refills quickly at the surface. At zero you take damage every 90 frames. Bullets slow down underwater too, and a pistol shot loses its range three times faster, which is why the harpoon is the underwater weapon.
Lighting with gradients and additive blending
Each frame draws the tiles and sprites, then a radial gradient from clear around the player to the theme's darkness at the edges. After that I switch globalCompositeOperation to lighter and draw flickering orange radial glows over every fire tile and a row of wall torches. Enemies are drawn with bright outlines above the water tint so they stay readable in flooded rooms.
Sprites come from a Node script that asks the OpenAI Images API for sprite sheets on a flat magenta background. It keys the magenta out with an edge flood-fill and despill, then slices the frames with sharp. In-game every sprite has a fallback: pixel art defined as strings in sprites.ts and rasterised into offscreen canvases, so a missing PNG never breaks a level.
3.Try it
Arrow keys or WASD to move, Space to jump (hold to swim up underwater), X or J to fire.


