diff options
author | Aki <please@ignore.pl> | 2022-04-18 20:38:16 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-18 20:39:44 +0200 |
commit | add251b4ea37b57cf926b07e5e04d9b065f82a2c (patch) | |
tree | 9cecb47f168c985017971a3373de59b35f85db1a /TestStage.cpp | |
parent | bbec07ab3de333649d14a64fa01f7e8ad6d56c58 (diff) | |
download | bullethell2022-add251b4ea37b57cf926b07e5e04d9b065f82a2c.zip bullethell2022-add251b4ea37b57cf926b07e5e04d9b065f82a2c.tar.gz bullethell2022-add251b4ea37b57cf926b07e5e04d9b065f82a2c.tar.bz2 |
Playing around with enemies, added dumb pos manipulation
Diffstat (limited to 'TestStage.cpp')
-rw-r--r-- | TestStage.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/TestStage.cpp b/TestStage.cpp index cc90f19..653d3c2 100644 --- a/TestStage.cpp +++ b/TestStage.cpp @@ -1,13 +1,21 @@ #include "TestStage.h" +#include <memory> +#include <utility> + #include "ExampleGenerator.h" TestStage::TestStage() : m_player {}, - m_const {}, - m_enemy {std::make_unique<ExampleGenerator>(m_const.m_bullets)} + m_const {} { + m_enemies.reserve(2); + for (const float x : {200.f, 600.f}) { + Enemy enemy(std::make_unique<ExampleGenerator>(m_const.m_bullets)); + enemy.set_position(x, 20.f); + m_enemies.push_back(std::move(enemy)); + } } @@ -15,7 +23,8 @@ void TestStage::update(const float dt) { m_player.update(dt); - m_enemy.update(dt); + for (auto& enemy : m_enemies) + enemy.update(dt); m_const.update(dt); bool collided = m_player.collide(m_const.m_bullets); (void) collided; @@ -26,7 +35,8 @@ void TestStage::draw() { m_const.draw(); - m_enemy.draw(); + for (auto& enemy : m_enemies) + enemy.draw(); m_player.draw(); } |