From 50671b483f101d99d1875e834ed30a504beba12b Mon Sep 17 00:00:00 2001 From: OpenClaw Engineer Date: Sat, 7 Mar 2026 11:15:59 -0600 Subject: [PATCH] Fix end-of-world portal flow to allow forward-only progression --- js/game.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/js/game.js b/js/game.js index 25b935a..1ab6f1d 100644 --- a/js/game.js +++ b/js/game.js @@ -176,7 +176,9 @@ function createInitialState(config = gameConfig) { portal: { active: false, entered: false, - x: worldWidth - 180, + // Keep portal close to the world edge so forward motion naturally carries + // the player into it once progression is unlocked. + x: worldWidth - 60, width: 52, height: 92, y: groundY - 92, @@ -521,11 +523,15 @@ function updatePortal(dt) { } const p = state.player; - const atWorldEnd = p.x >= worldWidth - p.width - 8; + const worldEndX = worldWidth - p.width - 8; + // Activate slightly before the hard clamp at world end so the player can + // continue moving right and enter the portal without reversing direction. + const portalActivationX = Math.max(0, state.portal.x - p.width - 24); + const reachedProgressionPoint = p.x >= portalActivationX; - if (atWorldEnd) { + if (reachedProgressionPoint) { state.portal.active = true; - state.worldCleared = true; + state.worldCleared = p.x >= worldEndX; } if (!state.portal.active || state.portal.entered) return;