Mechanic recipes

ASCII map with collection

Doors that open

Add the door from state instead of editing the map. Pass the same scene to movement and drawing.

Side-scrolling platformer

Keep camera and every field of motion in state. The defaults are tuned; do not pass physics options unless the game needs a different feel. Start with {x: 2, y: 14, camera: {x: 0, y: 0}} (feet on the ground platform).

Particles and HUD

Particle positions are px. Keep the game below the 40 px HUD.

Hit, damage and effects

Start hurt and shook at -9 so nothing flickers or shakes at the start. Enemies have a hurt frame too (slime-hurt).

Randomness

Same seed and index always give the same value.