(() => { const { Bodies } = Matter; const scenes = (window.PhysilinksSceneDefs = window.PhysilinksSceneDefs || []); scenes.push({ id: "stack-blocks", name: "Stack Blocks", config: { gravity: 1.85, spawnIntervalMs: 900, autoSpawn: true, minChain: 3, palette: ["#38bdf8", "#f97316", "#facc15", "#22c55e"], ballRadius: 18, ballShape: "rect", spawnColumns: 10, 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, clearAnimation: { type: "shatter", durationMs: 380, sizeScale: 2.2, }, }, }, 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, }, ), ]; }, }); })();