From c1f7b409bd6c883f7e9ff0f81afd3bee47469bdd Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Thu, 9 Jan 2025 14:50:28 +0100 Subject: removed iostream --- game/enemy/BattleScript.cpp | 2 -- game/enemy/EnemyScript.cpp | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/game/enemy/BattleScript.cpp b/game/enemy/BattleScript.cpp index 3eda89e..2d1e143 100644 --- a/game/enemy/BattleScript.cpp +++ b/game/enemy/BattleScript.cpp @@ -1,7 +1,6 @@ #include "BattleScript.h" #include "EnemyScript.h" #include -#include #include #include using namespace std; @@ -29,7 +28,6 @@ void BattleScript::fixed_update(duration_t dt) { } if (!enemies_alive) { this->battle_active = false; - cout << "battle won" << endl; this->trigger_event(); } } diff --git a/game/enemy/EnemyScript.cpp b/game/enemy/EnemyScript.cpp index 04d577a..2382847 100644 --- a/game/enemy/EnemyScript.cpp +++ b/game/enemy/EnemyScript.cpp @@ -2,7 +2,6 @@ #include "../Config.h" #include "../Random.h" #include "EnemyConfig.h" -#include #include #include #include @@ -42,17 +41,14 @@ void EnemyScript::fixed_update(duration_t dt) { Rigidbody & enemy_body = this->get_component(); AI & ai_component = this->get_component(); - //transform.position += enemy_body.data.linear_velocity * dt.count(); float direction_to_player_y = player_transform.position.y - transform.position.y; float distance_to_player_y = std::abs(direction_to_player_y); float adjustment_speed = speed * (distance_to_player_y / MAX_DISTANCE); - //cout << "before clamp speed: " << adjustment_speed << endl; adjustment_speed = std::clamp(adjustment_speed, MIN_SPEED, MAX_SPEED); - // Move the path nodes on the Y-axis - //cout << "adjusted_speed: " << adjustment_speed << endl; Rigidbody& player_body = this->get_components_by_tag("player").front(); + // move path nodes for (vec2 & path_node : ai_component.path) { path_node.y += (direction_to_player_y > 0 ? 1 : -1) * adjustment_speed * dt.count(); path_node.x += player_body.data.linear_velocity.x * dt.count(); -- cgit v1.2.3