Fix path disappearing by moving map-ground outside scrolling world, reduce speed to 8px per tick
This commit is contained in:
@@ -182,7 +182,7 @@ class Game {
|
|||||||
const viewW = world.parentElement.offsetWidth || 420;
|
const viewW = world.parentElement.offsetWidth || 420;
|
||||||
const viewH = world.parentElement.offsetHeight || 300;
|
const viewH = world.parentElement.offsetHeight || 300;
|
||||||
|
|
||||||
const SPEED = 12; /* px per tick */
|
const SPEED = 8; /* px per tick */
|
||||||
let dx = 0, dy = 0, dir = '';
|
let dx = 0, dy = 0, dir = '';
|
||||||
|
|
||||||
if (this._heldKeys.has('right')) { dx = SPEED; dir = 'right'; }
|
if (this._heldKeys.has('right')) { dx = SPEED; dir = 'right'; }
|
||||||
|
|||||||
+2
-1
@@ -107,13 +107,14 @@
|
|||||||
<span class="tree">🌲</span><span class="tree">🌳</span><span class="tree">🌲</span>
|
<span class="tree">🌲</span><span class="tree">🌳</span><span class="tree">🌲</span>
|
||||||
<span class="tree">🌳</span><span class="tree">🌲</span><span class="tree">🌳</span>
|
<span class="tree">🌳</span><span class="tree">🌲</span><span class="tree">🌳</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="map-ground"></div>
|
|
||||||
<!-- NPC with ! bubble — position driven by JS in world-px -->
|
<!-- NPC with ! bubble — position driven by JS in world-px -->
|
||||||
<div class="map-npc-wrap" id="map-npc-wrap">
|
<div class="map-npc-wrap" id="map-npc-wrap">
|
||||||
<div class="npc-bubble" id="npc-bubble">!</div>
|
<div class="npc-bubble" id="npc-bubble">!</div>
|
||||||
<div class="map-npc" id="map-npc"></div>
|
<div class="map-npc" id="map-npc"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Path stays fixed to the viewport — does not scroll -->
|
||||||
|
<div class="map-ground"></div>
|
||||||
<!-- Player stays fixed to viewport, only Y moves -->
|
<!-- Player stays fixed to viewport, only Y moves -->
|
||||||
<div class="map-player" id="map-player">🧢</div>
|
<div class="map-player" id="map-player">🧢</div>
|
||||||
<!-- Hints overlay the viewport, not the world -->
|
<!-- Hints overlay the viewport, not the world -->
|
||||||
|
|||||||
Reference in New Issue
Block a user