From dbfef52733b36f3f5a04c4a78cfb206594311888 Mon Sep 17 00:00:00 2001 From: Justin Oros Date: Thu, 14 May 2026 10:30:10 -0700 Subject: [PATCH] Fix NPC proximity threshold and walk clamp so player can reach and trigger NPC interaction --- game.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/game.js b/game.js index ecb42f9..2f07f3d 100644 --- a/game.js +++ b/game.js @@ -193,7 +193,7 @@ class Game { /* Clamp world X — left edge is 0, right edge is npcWorldX + half screen so the player can always walk far enough to reach the NPC */ - const maxWorldX = this.state.npcWorldX + Math.round(viewW * 0.5); + const maxWorldX = this.state.npcWorldX - Math.round(viewW / 2) + 100; this.state.worldX = Math.max(0, Math.min(maxWorldX, this.state.worldX + dx)); /* Clamp Y within a narrow vertical band (path area) */ this.state.worldY = Math.max(-30, Math.min(30, this.state.worldY + dy)); @@ -226,7 +226,7 @@ class Game { const viewH = world ? world.parentElement.offsetHeight : 300; const playerWorldX = this.state.worldX + viewW / 2; const dx = Math.abs(playerWorldX - this.state.npcWorldX); - const near = dx < 55; + const near = dx < 120; const hint = document.getElementById('map-talk-hint'); const bub = document.getElementById('npc-bubble'); @@ -257,7 +257,7 @@ class Game { const world = document.getElementById('map-inner'); const viewW = world ? world.parentElement.offsetWidth : 420; const playerWorldX = this.state.worldX + viewW / 2; - return Math.abs(playerWorldX - this.state.npcWorldX) < 55; + return Math.abs(playerWorldX - this.state.npcWorldX) < 120; } _talkToNPC() {