diff options
author | Aki <please@ignore.pl> | 2022-04-18 10:36:19 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-18 10:36:19 +0200 |
commit | 7e1081ff8f1297486e177bd716fecebb42c0182a (patch) | |
tree | 031f47bce6b1ecab5303139cb425ebf6ed5709d4 /ExampleGenerator.cpp | |
parent | 8209bbaf2a046199b9c65438fb4454ce01b42500 (diff) | |
download | bullethell2022-7e1081ff8f1297486e177bd716fecebb42c0182a.zip bullethell2022-7e1081ff8f1297486e177bd716fecebb42c0182a.tar.gz bullethell2022-7e1081ff8f1297486e177bd716fecebb42c0182a.tar.bz2 |
Added base class for generators
Diffstat (limited to 'ExampleGenerator.cpp')
-rw-r--r-- | ExampleGenerator.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ExampleGenerator.cpp b/ExampleGenerator.cpp index 7f4d41b..bcead95 100644 --- a/ExampleGenerator.cpp +++ b/ExampleGenerator.cpp @@ -1,7 +1,6 @@ #include "ExampleGenerator.h" #include <cmath> -#include <vector> #include <utility> #include <raylib.h> @@ -9,7 +8,8 @@ #include "Bullets.h" -ExampleGenerator::ExampleGenerator() : +ExampleGenerator::ExampleGenerator(ConstantVelocityBullet::Vector& bullets) : + m_bullets {bullets}, m_delay {0}, m_interval {0.2f}, m_cone {0.3f}, @@ -22,7 +22,7 @@ ExampleGenerator::ExampleGenerator() : void -ExampleGenerator::update(const float dt, std::vector<ConstantVelocityBullet>& bullets) +ExampleGenerator::update(const float dt) { m_delay += dt; if (m_delay > m_interval) { @@ -38,7 +38,7 @@ ExampleGenerator::update(const float dt, std::vector<ConstantVelocityBullet>& bu bullet.velocity.y = sin * m_speed; bullet.position.x = m_origin.x + cos * m_shift; bullet.position.y = m_origin.y + sin * m_shift; - bullets.push_back(std::move(bullet)); + m_bullets.push_back(std::move(bullet)); } m_segments += 3; if (m_segments > 20) |