From 535018f11db69d50bb4ad167e709cb66c51c4641 Mon Sep 17 00:00:00 2001 From: Daddy32 Date: Mon, 15 Dec 2025 22:32:30 +0100 Subject: [PATCH] Add Stack Blocks Chaos scene --- index.html | 1 + src/scenes/index.js | 1 + src/scenes/scene-stack-blocks-chaos.js | 87 ++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 src/scenes/scene-stack-blocks-chaos.js diff --git a/index.html b/index.html index afac0c0..ef8270c 100644 --- a/index.html +++ b/index.html @@ -103,6 +103,7 @@ + diff --git a/src/scenes/index.js b/src/scenes/index.js index 847dec6..5fbf24b 100644 --- a/src/scenes/index.js +++ b/src/scenes/index.js @@ -7,6 +7,7 @@ "scene-lava", "swirl-arena", "relax", + "stack-blocks-chaos", "low-g-terraces", "fast-drop-maze", "storm-grid", diff --git a/src/scenes/scene-stack-blocks-chaos.js b/src/scenes/scene-stack-blocks-chaos.js new file mode 100644 index 0000000..5dca736 --- /dev/null +++ b/src/scenes/scene-stack-blocks-chaos.js @@ -0,0 +1,87 @@ +(() => { + const { Bodies } = Matter; + const scenes = (window.PhysilinksSceneDefs = + window.PhysilinksSceneDefs || []); + + scenes.push({ + id: "stack-blocks-chaos", + name: "Stack Blocks Chaos", + config: { + gravity: 1.85, + spawnIntervalMs: 750, + autoSpawn: true, + minChain: 3, + palette: ["#fb7185", "#8b5cf6", "#22d3ee", "#fbbf24", "#24fbbf"], + ballRadius: 18, + ballShape: "rect", + spawnColumns: 12, + sizeFromColumns: true, + initialRows: 3, + requireClearSpawn: true, + squarePlayArea: true, + rowGapMultiplier: 1, + spawnInsets: ({ width }) => { + const wallThickness = Math.max(20, width * 0.02); + return { left: 0, right: 0 }; + }, + winCondition: { + type: "clearCount", + target: 100, + }, + link: { + stiffness: 0.85, + lengthScale: 1.05, + damping: 0.08, + lineWidth: 3, + rope: true, + renderType: "line", + maxLengthMultiplier: 2.5, + }, + }, + createBodies: (w, h) => { + const squareSize = Math.min(w, h); + const left = (w - squareSize) / 2; + const top = (h - squareSize) / 2; + const wallThickness = Math.max(20, w * 0.02); + const floorHeight = Math.max(30, squareSize * 0.06); + const wallRender = { + fillStyle: "#1e293b", + strokeStyle: "#94a3b8", + lineWidth: 2, + }; + return [ + Bodies.rectangle( + left - wallThickness / 2, + h / 2, + wallThickness, + h + wallThickness * 2, + { + isStatic: true, + render: wallRender, + }, + ), + Bodies.rectangle( + left + squareSize + wallThickness / 2, + h / 2, + wallThickness, + h + wallThickness * 2, + { + isStatic: true, + render: wallRender, + }, + ), + Bodies.rectangle( + w / 2, + h + floorHeight / 2, + w + wallThickness * 2, + floorHeight, + { + isStatic: true, + restitution: 0.2, + render: wallRender, + }, + ), + ]; + }, + }); +})();