summaryrefslogtreecommitdiffhomepage
path: root/TestStage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TestStage.cpp')
-rw-r--r--TestStage.cpp18
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();
}