From eb39a6654036dd88f603a8b395b34e014a062b1c Mon Sep 17 00:00:00 2001 From: Daddy32 Date: Sat, 13 Dec 2025 23:24:26 +0100 Subject: [PATCH] Turn off gravity on win and cap swirl arena spawns --- src/main.js | 14 +++++++++++++- src/scenes/scene-relax.js | 2 +- src/scenes/scene-swirl-arena.js | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index a17f888..4050406 100644 --- a/src/main.js +++ b/src/main.js @@ -438,6 +438,10 @@ ui.hideGameOver(); ui.hideWin(); ui.setPauseState(false); + engine.gravity.scale = + typeof currentScene?.config?.gravityScale === "number" + ? currentScene.config.gravityScale + : defaultGravityScale; engine.gravity.x = 0; engine.gravity.y = config.gravity; engine.timing.timeScale = 1; @@ -487,6 +491,11 @@ const applyWinEffects = () => { const winCond = currentScene?.config?.winCondition; if (!winCond || !winCond.onWin) return; + if (winCond.onWin.shoveBalls || winCond.onWin.disableGravity) { + engine.gravity.x = 0; + engine.gravity.y = 0; + engine.gravity.scale = 0; + } if (typeof winCond.onWin.setGravity === "number") { engine.gravity.y = winCond.onWin.setGravity; } @@ -1061,7 +1070,10 @@ Events.on(engine, "beforeUpdate", () => { // Rope-like constraint handling: allow shortening without push-back, tension when stretched. - if (typeof currentScene?.config?.onBeforeUpdate === "function") { + if ( + !levelWon && + typeof currentScene?.config?.onBeforeUpdate === "function" + ) { currentScene.config.onBeforeUpdate({ engine, width, height }); } chain.constraints.forEach((c) => { diff --git a/src/scenes/scene-relax.js b/src/scenes/scene-relax.js index 4d99773..5ff7907 100644 --- a/src/scenes/scene-relax.js +++ b/src/scenes/scene-relax.js @@ -31,7 +31,7 @@ lineWidth: 3, rope: true, renderType: "line", - maxLengthMultiplier: 3.8, + maxLengthMultiplier: 7.8, }, }, createBodies: (w, h) => { diff --git a/src/scenes/scene-swirl-arena.js b/src/scenes/scene-swirl-arena.js index 73e78b1..11ffd58 100644 --- a/src/scenes/scene-swirl-arena.js +++ b/src/scenes/scene-swirl-arena.js @@ -12,7 +12,7 @@ timeScale: 0.9, spawnIntervalMs: 520, initialSpawnCount: 90, - spawnLimit: 500, + spawnLimit: 300, autoSpawn: true, minChain: 3, palette: ["#f472b6", "#22c55e"], @@ -24,6 +24,7 @@ winCondition: { type: "colorClear", targets: [{ color: "#22c55e", count: 100 }], + onWin: { shoveBalls: true }, }, negativeScoreColors: ["#f472b6"], negativeProgressColors: ["#f472b6"],