Extract styles, add per-scene link tuning, update docs

This commit is contained in:
Daddy32
2025-12-12 16:10:26 +01:00
parent de28fa0cdd
commit 64acac1db0
4 changed files with 255 additions and 291 deletions

View File

@@ -12,7 +12,7 @@ Physilinks is a browser-based physics linking game built with Matter.js. Match a
## Tech notes
- **Engine**: Matter.js (via CDN). Canvas rendering with custom overlays for HUD, pause, game over, and score popups.
- **Scenes**: Defined in `main.js` as an array of presets (config + `createBodies` factory). Applying a scene updates gravity, spawn rate, ball radius, palette, and static bodies, then restarts the game.
- **Scenes**: Defined in `main.js` as an array of presets (config + `createBodies` factory). Applying a scene updates gravity, spawn rate, ball radius, palette, link constraints (stiffness/stretch/damping/width), and static bodies, then restarts the game.
- **Physics entities**: Falling balls (`Bodies.circle`) with gentle restitution/friction; static boundaries/obstacles per scene. The top is open; sides and floor are static bodies.
- **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.
@@ -22,5 +22,5 @@ Physilinks is a browser-based physics linking game built with Matter.js. Match a
## Development quick start
- No build step. Open `index.html` directly in the browser.
- Key files: `index.html` (layout/styles), `main.js` (game logic).
- Key files: `index.html` (layout), `styles.css` (styling), `main.js` (game logic).
- Adjust or add scenes in `main.js` by extending the `scenes` array with config and a `createBodies(width, height)` function.