From 1d212252cd39e259a2b7daf0cef01a38a181dc63 Mon Sep 17 00:00:00 2001 From: Justin Oros Date: Wed, 20 May 2026 21:49:19 -0700 Subject: [PATCH] Simplify NPC interaction to 300px radius --- game.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/game.js b/game.js index 65cf15c..1104ad1 100644 --- a/game.js +++ b/game.js @@ -430,7 +430,7 @@ class Game { const dx = this.state.npcWorldX - this.state.worldX; const dy = this.state.npcWorldY - this.state.worldY; const dist = Math.sqrt(dx * dx + dy * dy); - const near = !(this.state.npcWorldX === 0 && this.state.npcWorldY === 0) && dist < 200; + const near = !(this.state.npcWorldX === 0 && this.state.npcWorldY === 0) && dist < 300; const hint = document.getElementById('map-talk-hint'); const bub = document.getElementById('npc-bubble'); @@ -443,19 +443,10 @@ class Game { this._updateDirArrow(near); } - _npcOnScreen() { - const {viewW, viewH} = this._getViewport(); - const dx = this.state.npcWorldX - this.state.worldX; - const dy = this.state.npcWorldY - this.state.worldY; - const screenX = viewW / 2 + dx; - const screenY = viewH / 2 + dy; - return screenX > -60 && screenX < viewW + 60 && screenY > -60 && screenY < viewH + 60; - } - _updateDirArrow(nearNPC) { const arrow = document.getElementById('map-dir-arrow'); if (!arrow) return; - if (nearNPC || this._npcOnScreen()) { arrow.style.display = 'none'; arrow.style.animation = 'none'; return; } + if (nearNPC) { arrow.style.display = 'none'; arrow.style.animation = 'none'; return; } const {viewW, viewH} = this._getViewport(); const dx = this.state.npcWorldX - this.state.worldX; const dy = this.state.npcWorldY - this.state.worldY; @@ -492,7 +483,7 @@ class Game { if (this.state.npcWorldX === 0 && this.state.npcWorldY === 0) return false; const dx = this.state.npcWorldX - this.state.worldX; const dy = this.state.npcWorldY - this.state.worldY; - return Math.sqrt(dx * dx + dy * dy) < 200; + return Math.sqrt(dx * dx + dy * dy) < 300; } _talkToNPC() {