diff options
author | Aki <please@ignore.pl> | 2022-04-20 00:28:48 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-20 00:28:48 +0200 |
commit | fd9232b3d3a3aee28a5965a5ebc4077f8db7c652 (patch) | |
tree | e9bdb832ed15704f5640ffc9543131f02e6e6e32 /EnemyFactory.cpp | |
parent | 5f0c15b2d3299ea210a78d54e9b10c3cb4266139 (diff) | |
download | bullethell2022-fd9232b3d3a3aee28a5965a5ebc4077f8db7c652.zip bullethell2022-fd9232b3d3a3aee28a5965a5ebc4077f8db7c652.tar.gz bullethell2022-fd9232b3d3a3aee28a5965a5ebc4077f8db7c652.tar.bz2 |
Streamlined enemy composition
Diffstat (limited to 'EnemyFactory.cpp')
-rw-r--r-- | EnemyFactory.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/EnemyFactory.cpp b/EnemyFactory.cpp index b573228..8a51c3f 100644 --- a/EnemyFactory.cpp +++ b/EnemyFactory.cpp @@ -18,13 +18,15 @@ EnemyFactory::make_example( const bool mirror) { auto position = std::make_shared<Vector2>(Vector2{x, y}); - auto generator = std::make_unique<ExampleGenerator>(bullets); - auto behaviour = std::make_unique<FallingAndOscillating>(); + auto generator = std::make_shared<ExampleGenerator>(position, bullets); + auto behaviour = std::make_shared<FallingAndOscillating>(position, generator); + generator->m_position = position; if (mirror) { + generator->m_color = Color{100, 0, 255, 255}; generator->m_direction *= -1; - behaviour->set_phase(1.f); + behaviour->m_phase = 1.f; } - Enemy enemy(position, std::move(generator), std::move(behaviour)); + Enemy enemy(position, generator, behaviour); enemy.m_hold = hold; return enemy; } |