From 134c6e8e29f7c23209093dc2a1111839dc24bb0d Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Wed, 18 Jun 2014 09:09:56 -0700 Subject: [PATCH] Stop chasing me if you can't see me at the end of your path --- moonlight/js/moonlight-skulk.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/moonlight/js/moonlight-skulk.js b/moonlight/js/moonlight-skulk.js index 03ccfc2..d575c9d 100644 --- a/moonlight/js/moonlight-skulk.js +++ b/moonlight/js/moonlight-skulk.js @@ -714,6 +714,13 @@ var AISprite = function(game, x, y, key, frame) { this.canSeeSprite = function(spr, debug) { var vd = this.view_distance; + if ( hasState(this, STATE_FACE_LEFT) || + hasState(this, STATE_FACE_UP) ) { + // Without this the player can stand in our view distance + // but as long as their left edge is 1 px out we won't see them, + // with this we see their near edge + vd = vd + 32; + } if ( hasState(this, STATE_ALERTED) ) vd = vd * 2;