Fix end-of-world portal flow to allow forward-only progression

This commit is contained in:
OpenClaw Engineer 2026-03-07 11:15:59 -06:00
parent 52717f67a9
commit 50671b483f

View File

@ -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;