Document spawn module

This commit is contained in:
Daddy32
2025-12-15 18:10:16 +01:00
parent 946c73d933
commit e76b86f0a2

View File

@@ -17,7 +17,7 @@ Physilinks is a browser-based physics linking game built with Matter.js. Match a
- **Input**: Pointer/touch events mapped to scene coords; chain state tracks bodies and a dashed preview line to the pointer. Undo by dragging back to the previous node.
- **Scoring**: `10 × length²` per cleared chain. Score popup rendered as DOM element near release point (via UI module).
- **Persistence**: Per-scene high score stored in `localStorage` under `physilinks-highscore-<sceneId>`; loaded on scene change; HUD shows current scene's best.
- **Game loop**: Single Matter runner controlled in `main.js`. Pause/game over stop the runner and spawner and zero `engine.timing.timeScale` so physics and rotating obstacles freeze; resume restarts the runner and spawner.
- **Game loop**: Single Matter runner controlled in `main.js`, with spawning handled by `src/spawn.js`. Pause/game over stop the runner and spawner and zero `engine.timing.timeScale` so physics and rotating obstacles freeze; resume restarts the runner and spawner.
- **Lose detection**: Spawned balls monitor entry; if they remain near the spawn zone with negligible velocity after a short delay, the run is over.
## File structure
@@ -27,7 +27,8 @@ Physilinks is a browser-based physics linking game built with Matter.js. Match a
- `src/scenes/scene-template.js`: Reference-only template documenting every scene config option; not loaded by default.
- `src/decomp-setup.js`: Registers `poly-decomp` with Matter to allow concave shapes (stars, blobs) built via `Bodies.fromVertices`.
- `src/ui.js`: DOM access, HUD updates, overlays, popups, and control/selector wiring.
- `src/main.js`: Physics setup, state machine, chain interaction, spawning, scene application, and pause/restart logic.
- `src/spawn.js`: Spawner utilities (intervals, batch/column/grid spawns), ball creation (shapes/blobs), radius scaling, and blob cleanup.
- `src/main.js`: Physics setup, state machine, chain interaction, scene application, and pause/restart logic; delegates spawn duties to `src/spawn.js`.
## Development quick start
- No build step. Open `index.html` directly in the browser.