People keep chasing the guards even after touching the light - fix bad checks for undefined
This commit is contained in:
@@ -226,8 +226,8 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
|
|
||||||
this.path_set = function(target, force, maxsteps, useNearestWalkable) {
|
this.path_set = function(target, force, maxsteps, useNearestWalkable) {
|
||||||
useNearestWalkable = (typeof useNearestWalkable == 'undefined' ? true : useNearestWalkable);
|
useNearestWalkable = (typeof useNearestWalkable == 'undefined' ? true : useNearestWalkable);
|
||||||
maxsteps = (typeof maxsteps == undefined ? maxsteps : this.path_maximum_steps);
|
maxsteps = (typeof maxsteps == 'undefined' ? this.path_maximum_steps : maxsteps);
|
||||||
force = ( typeof force == undefined ? false : force );
|
force = ( typeof force == 'undefined' ? false : force );
|
||||||
if ( force == false &&
|
if ( force == false &&
|
||||||
this.path.length > 0 &&
|
this.path.length > 0 &&
|
||||||
this.path_index < this.path.length ) {
|
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)
|
this.chasetarget = function(target, alertedState, movingstate, visual, maxsteps, useNearestWalkable)
|
||||||
{
|
{
|
||||||
alertedState = (typeof alertedState == undefined ? STATE_ALERTED : alertedState);
|
alertedState = (typeof alertedState == 'undefined' ? STATE_ALERTED : alertedState);
|
||||||
visual = (typeof visual == undefined ? false : visual);
|
visual = (typeof visual == 'undefined' ? false : visual);
|
||||||
movingstate = (typeof alertedState == undefined ? STATE_NONE : movingstate);
|
movingstate = (typeof alertedState == 'undefined' ? STATE_NONE : movingstate);
|
||||||
if ( game.physics.arcade.collide(this, target) )
|
if ( game.physics.arcade.collide(this, target) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user