From e9bcefcff69637426156d939578092604c43f349 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sun, 22 Jun 2014 11:57:58 -0700 Subject: [PATCH] People keep chasing the guards even after touching the light - fix bad checks for undefined --- moonlight/src/AISprite.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/moonlight/src/AISprite.js b/moonlight/src/AISprite.js index e61699e..ff11da4 100644 --- a/moonlight/src/AISprite.js +++ b/moonlight/src/AISprite.js @@ -226,8 +226,8 @@ var AISprite = function(game, x, y, key, frame) { 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 ); + maxsteps = (typeof maxsteps == 'undefined' ? this.path_maximum_steps : maxsteps); + force = ( typeof force == 'undefined' ? false : force ); if ( force == false && this.path.length > 0 && this.path_index < this.path.length ) { @@ -334,9 +334,9 @@ var AISprite = function(game, x, y, key, frame) { this.chasetarget = function(target, alertedState, movingstate, visual, maxsteps, useNearestWalkable) { - alertedState = (typeof alertedState == undefined ? STATE_ALERTED : alertedState); - visual = (typeof visual == undefined ? false : visual); - movingstate = (typeof alertedState == undefined ? STATE_NONE : movingstate); + alertedState = (typeof alertedState == 'undefined' ? STATE_ALERTED : alertedState); + visual = (typeof visual == 'undefined' ? false : visual); + movingstate = (typeof alertedState == 'undefined' ? STATE_NONE : movingstate); if ( game.physics.arcade.collide(this, target) ) return;