Turn off gravity on win and cap swirl arena spawns

This commit is contained in:
Daddy32
2025-12-13 23:24:26 +01:00
parent ea2446e36b
commit eb39a66540
3 changed files with 16 additions and 3 deletions

View File

@@ -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) => {

View File

@@ -31,7 +31,7 @@
lineWidth: 3,
rope: true,
renderType: "line",
maxLengthMultiplier: 3.8,
maxLengthMultiplier: 7.8,
},
},
createBodies: (w, h) => {

View File

@@ -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"],