Move JavaScript files into src folder
This commit is contained in:
1 parent
20c6806598
commit
22c717a33e
12 files changed
+17
-17
No files matched your search
@@ -12,7 +12,7 @@ Physilinks is a browser-based physics linking game built with Matter.js. Match a
|
|||||||
|
|
||||||
## Tech notes
|
## Tech notes
|
||||||
- **Engine**: Matter.js (via CDN). Canvas rendering with custom overlays for HUD, pause, game over, and score popups.
|
- **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.
|
- **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.
|
- **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).
|
- **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
|
## File structure
|
||||||
- `index.html`: Shell layout and HUD overlays; loads Matter.js plus game scripts.
|
- `index.html`: Shell layout and HUD overlays; loads Matter.js plus game scripts.
|
||||||
- `styles.css`: Styling for canvas, HUD, overlays, and score popups.
|
- `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).
|
- `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).
|
||||||
- `decomp-setup.js`: Registers `poly-decomp` with Matter to allow concave shapes (stars, blobs) built via `Bodies.fromVertices`.
|
- `src/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.
|
- `src/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/main.js`: Physics setup, state machine, chain interaction, spawning, scene application, and pause/restart logic.
|
||||||
|
|
||||||
## Development quick start
|
## Development quick start
|
||||||
- No build step. Open `index.html` directly in the browser.
|
- 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).
|
- 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 in `scenes.js` by extending the `scenes` array with config and a `createBodies(width, height)` function.
|
- Adjust or add scenes by extending the files in `src/scenes/` with config and a `createBodies(width, height)` function.
|
||||||
+10
-10
@@ -93,15 +93,15 @@
|
|||||||
|
|
||||||
<script src="https://unpkg.com/matter-js@0.19.0/build/matter.min.js"></script>
|
<script src="https://unpkg.com/matter-js@0.19.0/build/matter.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/poly-decomp@0.3.0/build/decomp.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/poly-decomp@0.3.0/build/decomp.min.js"></script>
|
||||||
<script src="./decomp-setup.js"></script>
|
<script src="./src/decomp-setup.js"></script>
|
||||||
<script src="./scenes/scene-grid.js"></script>
|
<script src="./src/scenes/scene-grid.js"></script>
|
||||||
<script src="./scenes/scene-balanced.js"></script>
|
<script src="./src/scenes/scene-balanced.js"></script>
|
||||||
<script src="./scenes/scene-lowg.js"></script>
|
<script src="./src/scenes/scene-lowg.js"></script>
|
||||||
<script src="./scenes/scene-fastdrop.js"></script>
|
<script src="./src/scenes/scene-fastdrop.js"></script>
|
||||||
<script src="./scenes/scene-lavalamp.js"></script>
|
<script src="./src/scenes/scene-lavalamp.js"></script>
|
||||||
<script src="./scenes/scene-relax.js"></script>
|
<script src="./src/scenes/scene-relax.js"></script>
|
||||||
<script src="./scenes/index.js"></script>
|
<script src="./src/scenes/index.js"></script>
|
||||||
<script src="./ui.js"></script>
|
<script src="./src/ui.js"></script>
|
||||||
<script src="./main.js"></script>
|
<script src="./src/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user