From 898b6f4885bbcde903595f0a73580debe7ddda64 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sun, 22 Jun 2014 10:48:00 -0700 Subject: [PATCH] Guards don't contact the player anymore and people continue chasing the guards --- moonlight/src/AISprite.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/moonlight/src/AISprite.js b/moonlight/src/AISprite.js index 046ae2c..f83108a 100644 --- a/moonlight/src/AISprite.js +++ b/moonlight/src/AISprite.js @@ -224,7 +224,8 @@ var AISprite = function(game, x, y, key, frame) { this.path_index = 0; } - this.path_set = function(target, force, maxsteps) { + this.path_set = function(target, force, maxsteps, useNearestWalkable) { + useNearestWalkable = (typeof useNearestWalkable == 'undefined' ? true : useNearestWalkable); maxsteps = (typeof maxsteps == undefined ? maxsteps : this.path_maximum_steps); force = ( typeof force == undefined ? false : force ); if ( force == false && @@ -233,7 +234,11 @@ var AISprite = function(game, x, y, key, frame) { return false; } this.path_purge(); - var pos = nearestWalkableTile(target); + if ( useNearestWalkable == true ) { + var pos = nearestWalkableTile(target); + } else { + var pos = [parseInt(target.x/32), parseInt(target.y/32)]; + } tpath = pathfinder.findPath( parseInt(this.x/32), parseInt(this.y/32),