2.2 KiB
2.2 KiB
Repository Guidelines
Project Structure & Modules
index.htmlboots the canvas, HUD overlays, and pulls Matter.js plus all project scripts; open it directly or via a simple static server.styles.cssholds layout, HUD, overlays, and popup styling.src/main.jsruns the physics loop, spawning, scoring, and scene application;src/ui.jswires DOM/HUD controls and overlays.src/scenes/*.jsdefines scene presets (id,name,config,createBodies(width, height));src/scenes/index.jsregisters them towindow.PhysilinksScenes.src/scenes/scene-template.jsis a reference-only template documenting all supported scene config options; it is not loaded by default.src/decomp-setup.jsconfigurespoly-decompfor concave shapes;src/storage.jsreads/writes per-scene highscores/records inlocalStorage.
Build, Test, and Development Commands
- No build step. Serve or open locally:
python3 -m http.server 8000then visithttp://localhost:8000, or double-clickindex.html. - Use a modern desktop/mobile browser; Matter.js is loaded via CDN.
Coding Style & Naming Conventions
- JavaScript uses 2-space indentation, semicolons, and double quotes; keep functions/variables camelCase, constants UPPER_SNAKE_CASE.
- Scene files are kebab-cased (e.g.,
scene-storm-grid.js) and should export anidmatching the filename. Keep configs minimal: gravity, spawn settings, palette,linkoptions, andcreateBodies. - Favor small helpers over inline duplication; attach shared globals to
window.Physilinks*consistently.
Testing Guidelines
- No automated tests yet; rely on manual playthroughs. Recommended pass: load each scene, start a chain, clear at least one valid link, verify score popup and HUD update, pause/resume, and confirm run-over detection triggers when the entry is blocked.
- Validate persistence: switch scenes and ensure highscores reload; refresh to confirm
localStoragekeys (physilinks-highscore-<sceneId>) remain honored.
Commit & Pull Request Guidelines
- Follow the short, present-tense style from history (e.g.,
Add Storm Grid Shift scene,Clamp square spawns for stack blocks). - Call out any new globals, storage keys, or DOM IDs/classes. Keep diffs focused and avoid unrelated formatting churn.