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,11 +987,17 @@ var AISprite = function(game, x, y, key, frame) {
if ( this.path_index >= this.path.length ) { if ( this.path_index >= this.path.length ) {
this.path_tween_stop(); this.path_tween_stop();
this.path_set(player, true); if ( x.canSeeSprite(player, false) == true ) {
this.path_tween_start(); this.path_set(player, true);
} else {
if ( this.path_set(player, this.blocked(true)) )
this.path_tween_start(); 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 {
this.path_tween_start();
}
} }
return; return;
} }