From b6c7811eae4fa7c51f82c44c1558fcafc79c21e0 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Wed, 8 Jan 2025 15:46:56 +0100 Subject: queue added --- game/enemy/BattleScript.cpp | 4 ++-- game/enemy/EnemyScript.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'game') diff --git a/game/enemy/BattleScript.cpp b/game/enemy/BattleScript.cpp index dde8da1..6d96ef6 100644 --- a/game/enemy/BattleScript.cpp +++ b/game/enemy/BattleScript.cpp @@ -39,7 +39,7 @@ bool BattleScript::create_battle(const BattleStartEvent & e) { for (int i = 0; i < e.num_enemies; i++) { BehaviorScript & script = enemy_scripts[i]; script.active = true; - this->trigger_event( + this->queue_event( SpawnEnemyEvent { .speed = dist(engine), .column = i, @@ -47,5 +47,5 @@ bool BattleScript::create_battle(const BattleStartEvent & e) { script.game_object_id ); } - return true; + return false; } diff --git a/game/enemy/EnemyScript.cpp b/game/enemy/EnemyScript.cpp index 8e475a8..06626dd 100644 --- a/game/enemy/EnemyScript.cpp +++ b/game/enemy/EnemyScript.cpp @@ -79,7 +79,7 @@ bool EnemyScript::spawn_enemy(const SpawnEnemyEvent & e) { ai_component.make_oval_path(10, 10, vec2 {x_value, random_height}, 1.5708, true); ai_component.active = true; this->last_fired = std::chrono::steady_clock::now(); - return true; + return false; } bool EnemyScript::on_collide(const CollisionEvent & e) { -- cgit v1.2.3 From 65eff0cb9b645f81f8231e14f1e92c2abcda35ef Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Wed, 8 Jan 2025 15:50:12 +0100 Subject: removed p --- game/player/PlayerScript.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'game') diff --git a/game/player/PlayerScript.cpp b/game/player/PlayerScript.cpp index d32da0b..57819c0 100644 --- a/game/player/PlayerScript.cpp +++ b/game/player/PlayerScript.cpp @@ -94,11 +94,6 @@ void PlayerScript::fixed_update(crepe::duration_t dt) { } Rigidbody & rb = this->get_components_by_name("player").front(); - if (this->get_key_state(Keycode::P)) { - this->trigger_event(BattleStartEvent { - .num_enemies = 5, - }); - } if (this->get_key_state(Keycode::ENTER)) { auto now = std::chrono::steady_clock::now(); -- cgit v1.2.3