Stop chasing me if you can't see me at the end of your path

This commit is contained in:
2014-06-17 23:17:51 -07:00
parent 386dc802ed
commit 2c71af4339

View File

@@ -713,6 +713,10 @@ var AISprite = function(game, x, y, key, frame) {
}
this.canSeeSprite = function(spr, debug) {
var vd = this.view_distance;
if ( hasState(this, STATE_ALERTED) ) {
vd = vd * 2;
var xd = (spr.x - this.x);
if ( xd < 0 )
xd = -(xd);