summaryrefslogtreecommitdiffhomepage
path: root/ExampleGenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ExampleGenerator.cpp')
-rw-r--r--ExampleGenerator.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/ExampleGenerator.cpp b/ExampleGenerator.cpp
index f7af287..4c86d94 100644
--- a/ExampleGenerator.cpp
+++ b/ExampleGenerator.cpp
@@ -17,7 +17,6 @@ ExampleGenerator::ExampleGenerator(ConstantVelocityBullet::Vector& bullets) :
m_speed {100},
m_shift {10},
m_segments {2},
- m_origin {400, 20},
m_color {240, 0, 0, 255}
{
}
@@ -28,6 +27,7 @@ ExampleGenerator::update(const float dt)
{
m_delay += dt;
if (m_delay > m_interval) {
+ const auto pos = position();
m_delay -= m_interval;
for (float i = 0; i <= m_segments; ++i) {
const float angle = (m_angle - m_cone / 2 + m_cone * i / m_segments) * M_PI;
@@ -38,8 +38,8 @@ ExampleGenerator::update(const float dt)
bullet.radius = 4;
bullet.velocity.x = cos * m_speed;
bullet.velocity.y = sin * m_speed;
- bullet.position.x = m_origin.x + cos * m_shift;
- bullet.position.y = m_origin.y + sin * m_shift;
+ bullet.position.x = pos.x + cos * m_shift;
+ bullet.position.y = pos.y + sin * m_shift;
m_bullets.push_back(std::move(bullet));
}
m_angle += dt * 1.1f;