diff --git a/www/html/Game/public/js/play.js b/www/html/Game/public/js/play.js index d96e86d..16e8ccc 100644 --- a/www/html/Game/public/js/play.js +++ b/www/html/Game/public/js/play.js @@ -382,17 +382,20 @@ } } - function drawStackTowerScrollBgFullCanvas(cw, ch) { + /** zDrawPan = zoom ตอนวาด stack — ผูกเลื่อนแถบ BG กับกล้องโลก (px จอ = boostWorld * z) */ + function drawStackTowerScrollBgFullCanvas(cw, ch, zDrawPan) { const intro = stackTowerScrollBgIntroImg; const loop = stackTowerScrollBgLoopImg; if (!intro || !intro.complete || !loop || !loop.complete) return; + const zPan = Number(zDrawPan) > 0 ? zDrawPan : zoom; const cwR = Math.max(1, Math.round(cw)); const chR = Math.max(1, Math.round(ch)); const scaleI = cwR / intro.naturalWidth; 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; + const camFollowScreen = isStackTowerMissionUiMapPlay() ? getStackTowerBgScrollHeightBoostPx() * zPan : 0; + const S = stackTowerScrollBgPx + camFollowScreen; const vp0 = S; const vp1 = S + chR; const yLimit = vp1 + drawHLoop * 2; @@ -453,7 +456,7 @@ const scaleL = cwR / loop.naturalWidth; const drawHLoop = Math.max(1, Math.round(loop.naturalHeight * scaleL)); const skyScreenH = Math.min(chR, Math.ceil(-worldMinY * zDraw) + 4); - const scroll = (stackTowerScrollBgPx + getStackTowerBgScrollHeightBoostPx()) % drawHLoop; + const scroll = (stackTowerScrollBgPx + getStackTowerBgScrollHeightBoostPx() * zDraw) % drawHLoop; let y = -scroll; ctx.save(); ctx.imageSmoothingEnabled = false; @@ -12965,7 +12968,7 @@ } else if (stackTowerScrollBgDrawActive()) { ctx.fillStyle = '#0a0e22'; ctx.fillRect(0, 0, canvas.width, canvas.height); - drawStackTowerScrollBgFullCanvas(canvas.width, canvas.height); + drawStackTowerScrollBgFullCanvas(canvas.width, canvas.height, zDraw); } else if (mapBackgroundImg && mapBackgroundImg.complete && mapBackgroundImg.naturalWidth) { /* กล้องเห็นพื้นที่นอก [0,map] ได้ — ห้ามสุ่มต้นทาง drawImage เกินขอบภาพ (จะเกิดซ้ำ/เส้นตัด/ซ้อนกันที่ขอบจอ) */ ctx.fillStyle = (isSpaceShooter() || isBalloonBoss()) ? '#0a0e22' : '#1a1b26'; diff --git a/www/html/Game/public/play.html b/www/html/Game/public/play.html index b72e4f8..a726052 100644 --- a/www/html/Game/public/play.html +++ b/www/html/Game/public/play.html @@ -2009,7 +2009,7 @@ - +