Stop chasing me if you can't see me at the end of your path
This commit is contained in:
@@ -988,9 +988,11 @@ 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();
|
||||||
if ( this.canSeeSprite(player, false) == true ) {
|
if ( this.canSeeSprite(player, false) == true ) {
|
||||||
|
console.log("I am at the end of my path and can see the player");
|
||||||
this.path_set(player, true);
|
this.path_set(player, true);
|
||||||
this.path_tween_start();
|
this.path_tween_start();
|
||||||
} else {
|
} else {
|
||||||
|
console.log("I am at the end of my path but can't see the player");
|
||||||
if ( hasState(this, STATE_FACE_DOWN) ) {
|
if ( hasState(this, STATE_FACE_DOWN) ) {
|
||||||
setMovingState(this, STATE_FACE_LEFT);
|
setMovingState(this, STATE_FACE_LEFT);
|
||||||
} else if ( hasState(this, STATE_FACE_LEFT) ) {
|
} else if ( hasState(this, STATE_FACE_LEFT) ) {
|
||||||
@@ -1002,12 +1004,13 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( this.path_set(player, this.blocked(true)) == true )
|
if ( this.path_set(player, this.blocked(true)) == true ) {
|
||||||
if ( this.canSeeSprite(player, false) == false ) {
|
if ( this.canSeeSprite(player, false) == false ) {
|
||||||
this.path_tween_stop();
|
this.path_tween_stop();
|
||||||
} else {
|
} else {
|
||||||
this.path_tween_start();
|
this.path_tween_start();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user