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

This commit is contained in:
2014-06-17 21:02:19 -07:00
parent 2577563303
commit 35cd16f14b

View File

@@ -987,12 +987,18 @@ var AISprite = function(game, x, y, key, frame) {
if ( this.path_index >= this.path.length ) {
this.path_tween_stop();
if ( x.canSeeSprite(player, false) == true ) {
this.path_set(player, true);
this.path_tween_start();
}
} else {
if ( this.path_set(player, this.blocked(true)) == true )
if ( x.canSeeSprite(player, false) == true ) {
this.path_tween_stop();
} else {
if ( this.path_set(player, this.blocked(true)) )
this.path_tween_start();
}
}
return;
}