diff options
-rw-r--r-- | game/enemy/BattleScript.cpp | 4 | ||||
-rw-r--r-- | game/enemy/EnemyConfig.h | 1 | ||||
-rw-r--r-- | game/enemy/EnemyPool.cpp | 2 | ||||
-rw-r--r-- | game/enemy/EnemyPool.h | 4 |
4 files changed, 5 insertions, 6 deletions
diff --git a/game/enemy/BattleScript.cpp b/game/enemy/BattleScript.cpp index 7bea79a..798cbb9 100644 --- a/game/enemy/BattleScript.cpp +++ b/game/enemy/BattleScript.cpp @@ -1,5 +1,5 @@ #include "BattleScript.h" -#include "../enemy/EnemyConfig.h" +#include "EnemyConfig.h" #include "EnemyScript.h" #include "api/Transform.h" #include <crepe/api/AI.h> @@ -41,7 +41,7 @@ void BattleScript::spawn_enemies(int amount) { RefVector<AI> enemy_ai = this->get_components_by_tag<AI>("enemy"); std::uniform_real_distribution<float> dist(70, 150); int spawned = 0; - for (int i = 0; i < 7; i++) { + for (int i = 0; i < ENEMY_POOL_MAX; i++) { AI & ai = enemy_ai[i]; Transform & enemy_transform = this->get_components_by_id<Transform>(ai.game_object_id).front(); diff --git a/game/enemy/EnemyConfig.h b/game/enemy/EnemyConfig.h index f7b660a..f9fb469 100644 --- a/game/enemy/EnemyConfig.h +++ b/game/enemy/EnemyConfig.h @@ -5,3 +5,4 @@ // static constexpr crepe::vec2 PLAYER_BULLET_POOL_LOCATION = {0, -850}; static constexpr crepe::vec2 ENEMY_BULLET_POOL_LOCATION = {0, -750}; static constexpr crepe::vec2 ENEMY_POOL_LOCATION = {0, -650}; +static constexpr int ENEMY_POOL_MAX = 12; diff --git a/game/enemy/EnemyPool.cpp b/game/enemy/EnemyPool.cpp index a7179bf..135fc35 100644 --- a/game/enemy/EnemyPool.cpp +++ b/game/enemy/EnemyPool.cpp @@ -4,7 +4,7 @@ using namespace std; void EnemyPool::create_enemies(crepe::Scene & scn) { EnemySubScene enemy; int amount = 0; - while (amount < this->MAXIMUM_AMOUNT) { + while (amount < ENEMY_POOL_MAX) { amount = enemy.create(scn, amount); } } diff --git a/game/enemy/EnemyPool.h b/game/enemy/EnemyPool.h index ec96ac4..25f7fb8 100644 --- a/game/enemy/EnemyPool.h +++ b/game/enemy/EnemyPool.h @@ -1,11 +1,9 @@ #pragma once #include <crepe/api/Scene.h> - +#include "EnemyConfig.h" class EnemyPool { public: void create_enemies(crepe::Scene & scn); -private: - static constexpr int MAXIMUM_AMOUNT = 7; }; |