Turn off gravity on win and cap swirl arena spawns
This commit is contained in:
14
src/main.js
14
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) => {
|
||||
|
||||
Reference in New Issue
Block a user