diff --git a/README.md b/README.md index 6507ca9..14faa50 100644 --- a/README.md +++ b/README.md @@ -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 `scenes.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. +- **Scenes**: Defined in `src/scenes/*.js` as 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 (via UI module). @@ -23,12 +23,12 @@ Physilinks is a browser-based physics linking game built with Matter.js. Match a ## File structure - `index.html`: Shell layout and HUD overlays; loads Matter.js plus game scripts. - `styles.css`: Styling for canvas, HUD, overlays, and score popups. -- `scenes/`: Scene presets split per file (`scene-*.js`) plus `index.js` that registers them to `window.PhysilinksScenes` (e.g., zero-G grid, balanced, low-G, fast drop, lava drift). -- `decomp-setup.js`: Registers `poly-decomp` with Matter to allow concave shapes (stars, blobs) built via `Bodies.fromVertices`. -- `ui.js`: DOM access, HUD updates, overlays, popups, and control/selector wiring. -- `main.js`: Physics setup, state machine, chain interaction, spawning, scene application, and pause/restart logic. +- `src/scenes/`: Scene presets split per file (`scene-*.js`) plus `index.js` that registers them to `window.PhysilinksScenes` (e.g., zero-G grid, balanced, low-G, fast drop, lava drift). +- `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. ## Development quick start - No build step. Open `index.html` directly in the browser. -- Key files: `index.html` (layout), `styles.css` (styling), `ui.js` (DOM/HUD), `main.js` (physics/game logic), `scenes.js` (scene data). -- Adjust or add scenes in `scenes.js` by extending the `scenes` array with config and a `createBodies(width, height)` function. +- Key files: `index.html` (layout), `styles.css` (styling), `src/ui.js` (DOM/HUD), `src/main.js` (physics/game logic), `src/scenes/index.js` (scene registration). +- Adjust or add scenes by extending the files in `src/scenes/` with config and a `createBodies(width, height)` function. diff --git a/index.html b/index.html index 4986279..6ce76ce 100644 --- a/index.html +++ b/index.html @@ -93,15 +93,15 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/decomp-setup.js b/src/decomp-setup.js similarity index 100% rename from decomp-setup.js rename to src/decomp-setup.js diff --git a/main.js b/src/main.js similarity index 100% rename from main.js rename to src/main.js diff --git a/scenes/index.js b/src/scenes/index.js similarity index 100% rename from scenes/index.js rename to src/scenes/index.js diff --git a/scenes/scene-balanced.js b/src/scenes/scene-balanced.js similarity index 100% rename from scenes/scene-balanced.js rename to src/scenes/scene-balanced.js diff --git a/scenes/scene-fastdrop.js b/src/scenes/scene-fastdrop.js similarity index 100% rename from scenes/scene-fastdrop.js rename to src/scenes/scene-fastdrop.js diff --git a/scenes/scene-grid.js b/src/scenes/scene-grid.js similarity index 100% rename from scenes/scene-grid.js rename to src/scenes/scene-grid.js diff --git a/scenes/scene-lavalamp.js b/src/scenes/scene-lavalamp.js similarity index 100% rename from scenes/scene-lavalamp.js rename to src/scenes/scene-lavalamp.js diff --git a/scenes/scene-lowg.js b/src/scenes/scene-lowg.js similarity index 100% rename from scenes/scene-lowg.js rename to src/scenes/scene-lowg.js diff --git a/scenes/scene-relax.js b/src/scenes/scene-relax.js similarity index 100% rename from scenes/scene-relax.js rename to src/scenes/scene-relax.js diff --git a/ui.js b/src/ui.js similarity index 100% rename from ui.js rename to src/ui.js