From 01d801a8a5971eda97f35e15143689c0aa8612c0 Mon Sep 17 00:00:00 2001 From: giteaadmin Date: Sun, 3 May 2026 04:58:34 +0000 Subject: [PATCH] =?UTF-8?q?Game:=20stack=20tower=20BG=20follow=20=E2=80=94?= =?UTF-8?q?=20scale=20strip=20offset=20+=20parallax=20mapBackgroundImg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit World px/layer was too weak on intro/loop strip; scale boost into strip space. When using editor map background image, shift BG sample window with effCamY only. Co-authored-by: Cursor --- www/html/Game/public/js/play.js | 15 +++++++++++---- www/html/Game/public/play.html | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/www/html/Game/public/js/play.js b/www/html/Game/public/js/play.js index 322f175..8de35b5 100644 --- a/www/html/Game/public/js/play.js +++ b/www/html/Game/public/js/play.js @@ -387,7 +387,10 @@ const drawHIntro = Math.round(intro.naturalHeight * scaleI); const scaleL = cwR / loop.naturalWidth; const drawHLoop = Math.max(1, Math.round(loop.naturalHeight * scaleL)); - const S = stackTowerScrollBgPx + getStackTowerBgScrollHeightBoostPx(); + const worldBoost = getStackTowerBgScrollHeightBoostPx(); + const mapHpxRef = (mapData && mapData.height ? mapData.height : 15) * (tileSize || 32); + const stripScale = Math.max(1.2, (drawHIntro + drawHLoop * 0.9) / Math.max(mapHpxRef * 0.32, 140)); + const S = stackTowerScrollBgPx + worldBoost * stripScale; const vp0 = S; const vp1 = S + chR; const yLimit = vp1 + drawHLoop * 2; @@ -12916,17 +12919,21 @@ ctx.fillRect(0, 0, canvas.width, canvas.height); const natW = mapBackgroundImg.naturalWidth; const natH = mapBackgroundImg.naturalHeight; + const towerBgBoost = (isStackTowerMissionUiMapPlay() && stackMini) ? getStackTowerBgScrollHeightBoostPx() : 0; + const bgCamY = camY - towerBgBoost; + const worldMinYBg = bgCamY - halfH; + const worldMaxYBg = bgCamY + halfH; const bgMinX = Math.max(0, worldMinX); const bgMaxX = Math.min(mapWpx, worldMaxX); - const bgMinY = Math.max(0, worldMinY); - const bgMaxY = Math.min(mapHpx, worldMaxY); + const bgMinY = Math.max(0, worldMinYBg); + const bgMaxY = Math.min(mapHpx, worldMaxYBg); if (bgMaxX > bgMinX && bgMaxY > bgMinY) { const srcX = (bgMinX / mapWpx) * natW; const srcY = (bgMinY / mapHpx) * natH; const srcW = ((bgMaxX - bgMinX) / mapWpx) * natW; const srcH = ((bgMaxY - bgMinY) / mapHpx) * natH; const destX = (bgMinX - camX) * zDraw + canvas.width / 2; - const destY = (bgMinY - camY) * zDraw + canvas.height / 2; + const destY = (bgMinY - bgCamY) * zDraw + canvas.height / 2; const destW = (bgMaxX - bgMinX) * zDraw; const destH = (bgMaxY - bgMinY) * zDraw; if (srcW > 0.25 && srcH > 0.25 && destW > 0.25 && destH > 0.25) { diff --git a/www/html/Game/public/play.html b/www/html/Game/public/play.html index e299770..c6e43da 100644 --- a/www/html/Game/public/play.html +++ b/www/html/Game/public/play.html @@ -2009,7 +2009,7 @@ - +
v —