aboutsummaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-09 14:50:28 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-09 14:50:28 +0100
commitc1f7b409bd6c883f7e9ff0f81afd3bee47469bdd (patch)
tree6121e5a60a02af3dca226d74ad381b856a0b8ae7 /game
parent00f48f0b3ea0853d5277caef3fed6cff0042c607 (diff)
removed iostream
Diffstat (limited to 'game')
-rw-r--r--game/enemy/BattleScript.cpp2
-rw-r--r--game/enemy/EnemyScript.cpp6
2 files changed, 1 insertions, 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 <crepe/api/AI.h>
-#include <iostream>
#include <crepe/api/BehaviorScript.h>
#include <crepe/api/Metadata.h>
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<BattleWonEvent>();
}
}
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 <iostream>
#include <crepe/api/AI.h>
#include <crepe/api/Animator.h>
#include <crepe/api/AudioSource.h>
@@ -42,17 +41,14 @@ void EnemyScript::fixed_update(duration_t dt) {
Rigidbody & enemy_body = this->get_component<Rigidbody>();
AI & ai_component = this->get_component<AI>();
- //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<Rigidbody>("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();