diff options
-rw-r--r-- | src/flier.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/flier.c b/src/flier.c index 81596d0..c507bd2 100644 --- a/src/flier.c +++ b/src/flier.c @@ -270,12 +270,16 @@ static int flier_update(struct entity *self) { case FLIER_PATROL: move2(self); if (ext->reached_x && ext->reached_y) { - ext->current_node++; + size_t const last_node = ext->current_node++; if (ext->current_node == ext->path_length) { ext->current_node = 0; } - ext->reached_x = false; - ext->reached_y = false; + if (ext->path[last_node].x != ext->path[ext->current_node].x) { + ext->reached_x = false; + } + if (ext->path[last_node].y != ext->path[ext->current_node].y) { + ext->reached_y = false; + } anim(self, FLIER_A_IDLE); self->state = FLIER_IDLE; self->timer = ext->idle_time; |