diff options
author | Aki <please@ignore.pl> | 2022-04-19 23:48:20 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-19 23:48:20 +0200 |
commit | 5f0c15b2d3299ea210a78d54e9b10c3cb4266139 (patch) | |
tree | 137190dde6dcab1951301f1a2ac1db8481878f5a /TestStage.cpp | |
parent | 78097b5496209b56cef9d7fc8d6c13e4c87e0eb1 (diff) | |
download | bullethell2022-5f0c15b2d3299ea210a78d54e9b10c3cb4266139.zip bullethell2022-5f0c15b2d3299ea210a78d54e9b10c3cb4266139.tar.gz bullethell2022-5f0c15b2d3299ea210a78d54e9b10c3cb4266139.tar.bz2 |
Created factory to handle enemy creation
Diffstat (limited to 'TestStage.cpp')
-rw-r--r-- | TestStage.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/TestStage.cpp b/TestStage.cpp index e6406f8..d858fcb 100644 --- a/TestStage.cpp +++ b/TestStage.cpp @@ -5,28 +5,19 @@ #include <raylib.h> -#include "ExampleGenerator.h" -#include "FallingAndOscillating.h" +#include "EnemyFactory.h" TestStage::TestStage() : m_player {}, m_const {} { - m_enemies.reserve(2); - for (const float x : {350.f, 450.f, 400.f}) { - auto position = std::make_shared<Vector2>(Vector2{x, 100.f}); - auto generator = std::make_unique<ExampleGenerator>(m_const.m_bullets); - auto behaviour = std::make_unique<FallingAndOscillating>(); - if (x > 410.f) { - generator->m_direction *= -1; - behaviour->set_phase(1.f); - } - Enemy enemy(position, std::move(generator), std::move(behaviour)); - if (x > 390.f && x < 410.f) - enemy.set_hold(20.f); - m_enemies.push_back(std::move(enemy)); - } + m_enemies.reserve(5); + m_enemies.push_back(std::move(EnemyFactory::make_example(m_const.m_bullets, 300, -10, 0))); + m_enemies.push_back(std::move(EnemyFactory::make_example(m_const.m_bullets, 500, -10, 0, true))); + m_enemies.push_back(std::move(EnemyFactory::make_example(m_const.m_bullets, 400, -10, 10))); + m_enemies.push_back(std::move(EnemyFactory::make_example(m_const.m_bullets, 550, -10, 20))); + m_enemies.push_back(std::move(EnemyFactory::make_example(m_const.m_bullets, 250, -10, 20, true))); } |