From 9bed2f6125605a7bfe0eadb96ad00d9c2d57dc56 Mon Sep 17 00:00:00 2001 From: Daddy32 Date: Sun, 14 Dec 2025 21:05:33 +0100 Subject: [PATCH] Add stack blocks scene with column spawning --- src/scenes/scene-stack-blocks.js | 71 ++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/scenes/scene-stack-blocks.js diff --git a/src/scenes/scene-stack-blocks.js b/src/scenes/scene-stack-blocks.js new file mode 100644 index 0000000..30b0bc9 --- /dev/null +++ b/src/scenes/scene-stack-blocks.js @@ -0,0 +1,71 @@ +(() => { + const { Bodies } = Matter; + const scenes = (window.PhysilinksSceneDefs = + window.PhysilinksSceneDefs || []); + + scenes.push({ + id: "stack-blocks", + name: "Stack Blocks", + config: { + gravity: 1.05, + spawnIntervalMs: 900, + autoSpawn: true, + minChain: 3, + palette: ["#38bdf8", "#f97316", "#facc15", "#22c55e"], + ballRadius: 18, + ballShape: "rect", + spawnColumns: 10, + initialRows: 3, + winCondition: { + type: "clearCount", + target: 100, + }, + link: { + stiffness: 0.85, + lengthScale: 1.05, + damping: 0.08, + lineWidth: 3, + rope: true, + renderType: "line", + maxLengthMultiplier: 3.1, + }, + }, + createBodies: (w, h) => { + const wallThickness = Math.max(20, w * 0.02); + const floorHeight = Math.max(30, h * 0.06); + return [ + Bodies.rectangle( + -wallThickness / 2, + h / 2, + wallThickness, + h * 2, + { + isStatic: true, + render: { fillStyle: "#0b1222", strokeStyle: "#0b1222" }, + }, + ), + Bodies.rectangle( + w + wallThickness / 2, + h / 2, + wallThickness, + h * 2, + { + isStatic: true, + render: { fillStyle: "#0b1222", strokeStyle: "#0b1222" }, + }, + ), + Bodies.rectangle( + w / 2, + h + floorHeight / 2, + w + wallThickness * 2, + floorHeight, + { + isStatic: true, + restitution: 0.2, + render: { fillStyle: "#0b1222", strokeStyle: "#0b1222" }, + }, + ), + ]; + }, + }); +})();