Move direction arrow inside game on right edge, always points right toward NPC

This commit is contained in:
justin committed 2026-05-14 10:47:27 -07:00
1 parent 9802427340
commit e354ddc224
2 files changed
+7 -8

No files matched your search

+3 -5
View File
@@ -256,13 +256,11 @@ class Game {
if (!arrow) return;
if (nearNPC) { arrow.style.display = 'none'; return; }
const world = document.getElementById('map-inner');
const viewW = world ? world.parentElement.offsetWidth : 420;
const viewH = world ? world.parentElement.offsetHeight : 300;
const npcScreenX = this.state.npcWorldX - this.state.worldX;
arrow.textContent = npcScreenX >= viewW / 2 ? '▶' : '◀';
arrow.textContent = '▶';
arrow.style.display = 'block';
arrow.style.left = (viewW / 2 + 30) + 'px';
arrow.style.bottom = (viewH * 0.48) + 'px';
arrow.style.removeProperty('left');
arrow.style.bottom = (viewH * 0.42) + 'px';
}
_nearNPC() {