diff --git a/src/enemy.cpp b/src/enemy.cpp index bacc884..9e7c83c 100644 --- a/src/enemy.cpp +++ b/src/enemy.cpp @@ -37,6 +37,11 @@ void Enemy::_process(double delta) { this->rotate_y(step); this->at_target_angle = false; } + if(this->can_see_player) { + this->last_known_player_position = this->player->get_global_position(); + this->last_known_player_rotation = -this->player->get_global_rotation().y; + this->shots_fired = 0; + } } void Enemy::_on_velocity_calculated(gd::Vector3 velocity) { @@ -45,11 +50,6 @@ void Enemy::_on_velocity_calculated(gd::Vector3 velocity) { } void Enemy::update() { - if(this->can_see_player) { - this->last_known_player_position = this->player->get_global_position(); - this->last_known_player_rotation = -this->player->get_global_rotation().y; - this->shots_fired = 0; - } if(this->current_action_fn != nullptr) this->current_action_fn = (ActionFn)(this->*current_action_fn)(); }