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