From c7ae756776a9defa7652a953db378e714d80363f Mon Sep 17 00:00:00 2001 From: Sara Date: Wed, 25 Dec 2024 18:25:07 +0100 Subject: [PATCH] feat: last known player transform now updates in _process --- src/enemy.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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)(); }