aboutsummaryrefslogtreecommitdiff
path: root/game/player/PlayerScript.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-08 12:38:24 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-08 12:38:24 +0100
commit9625b751757b8828b0edb0b7543c7cadfd25c119 (patch)
tree864d26cb57fe11887f4cd10923cd9a9d0b823af4 /game/player/PlayerScript.cpp
parentdc5d46426b30303843e8746d514db6f55ce1495b (diff)
enemy sequence working
Diffstat (limited to 'game/player/PlayerScript.cpp')
-rw-r--r--game/player/PlayerScript.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/game/player/PlayerScript.cpp b/game/player/PlayerScript.cpp
index dc3eec3..7bc5e55 100644
--- a/game/player/PlayerScript.cpp
+++ b/game/player/PlayerScript.cpp
@@ -1,4 +1,3 @@
-#include <iostream>
#include "PlayerScript.h"
#include "../Config.h"
@@ -157,25 +156,19 @@ void PlayerScript::fixed_update(crepe::duration_t dt) {
}
void PlayerScript::shoot(const vec2& location,float angle){
- //cout << "player shot" << endl;
RefVector<Transform> bullet_transforms = this->get_components_by_tag<Transform>("player_bullet");
for(Transform& bullet_pos : bullet_transforms){
- //cout << "bullet pos x: " << bullet_pos.position.x << " y: " << bullet_pos.position.y << endl;
if(bullet_pos.position.x == 0 && bullet_pos.position.y == -850){
-
- //cout << "bullet found\n";
+
bullet_pos.position = location;
bullet_pos.position.x += 20;
- //cout << "bullet pos x: " << bullet_pos.position.x << " y: " << bullet_pos.position.y << endl;
Rigidbody& bullet_body = this->get_components_by_id<Rigidbody>(bullet_pos.game_object_id).front();
BoxCollider bullet_collider = this->get_components_by_id<BoxCollider>(bullet_pos.game_object_id).front();
- //bullet_collider.active = true;
bullet_body.active = true;
BehaviorScript& bullet_script = this->get_components_by_id<BehaviorScript>(bullet_pos.game_object_id).front();
bullet_script.active = true;
return;
}
}
- cout << "bullet not found\n";
}