Game: stack tower height-follow applies to BG strip only, not world camera
Move stackTowerCameraFollow offset from getStackCameraCentersPx into drawStackTowerScrollBgFullCanvas (S += height boost). Clarify editor copy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -264,13 +264,13 @@
|
||||
<button type="button" id="btn-clear-bg">ลบรูปพื้นหลัง</button>
|
||||
</div>
|
||||
<div id="editor-stack-tower-cam-block" class="editor-bg-scroll-block" hidden>
|
||||
<p class="legend" style="margin:0.5rem 0 0.35rem;line-height:1.45"><strong>กล้องตามความสูงหอ</strong> (เฉพาะฉากรหัส <code>mnn93hpi</code> · Stack Tower) — เลื่อนมุมมองขึ้นเมื่อสแต็กสูงขึ้น · <em>English:</em> Camera pans up as blocks stack; saved in map JSON.</p>
|
||||
<p class="legend" style="margin:0.5rem 0 0.35rem;line-height:1.45"><strong>พื้นหลังเลื่อนตามความสูงหอ</strong> (เฉพาะฉาก <code>mnn93hpi</code> + แถบ intro/loop ด้านบน) — บวก offset ในแถบ BG เมื่อสแต็กสูง · กล้องเกม/แพลตฟอร์ม<strong>ไม่</strong>เลื่อน · <em>English:</em> Extra scroll on BG strip only; world camera stays fixed; saved as <code>stackTowerCameraFollow</code>.</p>
|
||||
<div class="editor-card__row editor-card__row--wrap" style="align-items:center;gap:0.75rem 1rem">
|
||||
<label class="editor-bg-scroll-check"><input type="checkbox" id="editor-stack-tower-cam-enabled" checked> เปิดตามชั้น / Follow stack height</label>
|
||||
<label title="พิกเซลโลกต่อ 1 ชั้นที่สแต็กแล้ว — ยิ่งมากยิ่งเลื่อนเร็ว">px ต่อชั้น
|
||||
<label class="editor-bg-scroll-check"><input type="checkbox" id="editor-stack-tower-cam-enabled" checked> เปิดตามชั้น / Follow stack (BG strip)</label>
|
||||
<label title="พิกเซลในแถบ BG ต่อ 1 ชั้น (ไม่ใช่พิกเซลโลกเกม)">px ต่อชั้น (ในแถบ BG)
|
||||
<input type="number" id="editor-stack-tower-cam-px-layer" min="0" max="80" step="1" value="12" style="width:4.2rem">
|
||||
</label>
|
||||
<label title="จำกัดการเลื่อนสูงสุด (พิกเซลโลก)">เลื่อนสูงสุด (px)
|
||||
<label title="จำกัด offset สะสมสูงสุดในแถบ BG">สูงสุด (px ในแถบ BG)
|
||||
<input type="number" id="editor-stack-tower-cam-max-px" min="0" max="800" step="4" value="260" style="width:4.5rem">
|
||||
</label>
|
||||
</div>
|
||||
@@ -335,7 +335,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="js/version.js?v=0.0169"></script>
|
||||
<script src="js/editor.js?v=20260503-stack-tower-bg-intro-loop"></script>
|
||||
<script src="js/editor.js?v=20260503-stack-bg-follow-only"></script>
|
||||
<div class="version-tag">v —</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -387,7 +387,7 @@
|
||||
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 S = stackTowerScrollBgPx + getStackTowerBgScrollHeightBoostPx();
|
||||
const vp0 = S;
|
||||
const vp1 = S + chR;
|
||||
const yLimit = vp1 + drawHLoop * 2;
|
||||
@@ -6553,10 +6553,24 @@
|
||||
return { enabled: raw.enabled !== false, pxPerLayer, maxPx };
|
||||
}
|
||||
|
||||
/** เลื่อนเฉพาะแถบ BG (stackTowerScrollBg) — ไม่เลื่อนกล้องโลก */
|
||||
function getStackTowerBgScrollHeightBoostPx() {
|
||||
if (!isStackTowerMissionUiMapPlay() || !stackMini) return 0;
|
||||
const cfg = getStackTowerCameraFollowPlayConfig();
|
||||
if (!cfg.enabled || cfg.pxPerLayer <= 0) return 0;
|
||||
const n = stackMini.layers ? stackMini.layers.length : 0;
|
||||
let layerCount = n;
|
||||
if (stackFall) {
|
||||
const dur = Math.max(1, stackFall.dur || 400);
|
||||
const u = Math.min(1, Math.max(0, (performance.now() - stackFall.t0) / dur));
|
||||
layerCount = n + u * 0.9;
|
||||
}
|
||||
return Math.min(cfg.maxPx, layerCount * cfg.pxPerLayer);
|
||||
}
|
||||
|
||||
function getStackCameraCentersPx() {
|
||||
const w = mapData.width || 20, h = mapData.height || 15;
|
||||
const ts = tileSize;
|
||||
const mapHpx = h * ts;
|
||||
const land = getStackAreaBoundsPlay(mapData.stackLandArea, w, h);
|
||||
const rel = getStackAreaBoundsPlay(mapData.stackReleaseArea, w, h);
|
||||
let cx = (w / 2) * ts;
|
||||
@@ -6571,20 +6585,6 @@
|
||||
cx = rel.cx * ts;
|
||||
cy = rel.cy * ts;
|
||||
}
|
||||
if (isStackTowerMissionUiMapPlay() && stackMini) {
|
||||
const cfg = getStackTowerCameraFollowPlayConfig();
|
||||
if (cfg.enabled && cfg.pxPerLayer > 0) {
|
||||
const n = stackMini.layers ? stackMini.layers.length : 0;
|
||||
let layerCount = n;
|
||||
if (stackFall) {
|
||||
const dur = Math.max(1, stackFall.dur || 400);
|
||||
const u = Math.min(1, Math.max(0, (performance.now() - stackFall.t0) / dur));
|
||||
layerCount = n + u * 0.9;
|
||||
}
|
||||
const shift = Math.min(cfg.maxPx, layerCount * cfg.pxPerLayer);
|
||||
cy = Math.max(ts * 1.5, Math.min(mapHpx - ts * 2, cy - shift));
|
||||
}
|
||||
}
|
||||
return { px: cx, py: cy };
|
||||
}
|
||||
|
||||
|
||||
@@ -2009,7 +2009,7 @@
|
||||
</div>
|
||||
<script src="/Game/socket.io/socket.io.js"></script>
|
||||
<script src="js/version.js?v=0.0184"></script>
|
||||
<script src="js/play.js?v=0.267"></script>
|
||||
<script src="js/play.js?v=0.268"></script>
|
||||
<div class="version-tag">v —</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user