summaryrefslogtreecommitdiffhomepage
path: root/WaveGenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WaveGenerator.cpp')
-rw-r--r--WaveGenerator.cpp47
1 files changed, 0 insertions, 47 deletions
diff --git a/WaveGenerator.cpp b/WaveGenerator.cpp
deleted file mode 100644
index 5d8dd9f..0000000
--- a/WaveGenerator.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "WaveGenerator.h"
-
-#include <cmath>
-#include <memory>
-#include <utility>
-
-#include <raylib.h>
-
-#include "ConstantVelocity.h"
-
-
-WaveGenerator::WaveGenerator(std::shared_ptr<Vector2> position, ConstantVelocityBullet::Vector& bullets) :
- m_position {position},
- m_bullets {bullets},
- m_delay {0},
- m_interval {0.22f},
- m_speed {100},
- m_shift {10},
- m_segments {30},
- m_color {100, 100, 240, 255}
-{
-}
-
-
-void
-WaveGenerator::update(const float dt)
-{
- if (!m_enabled)
- return;
- m_delay += dt;
- if (m_delay > m_interval) {
- m_delay -= m_interval;
- for (float i = 0; i < m_segments; ++i) {
- const float angle = (2.f / m_segments * i) * M_PI;
- const float cos = std::cos(angle);
- const float sin = std::sin(angle);
- ConstantVelocityBullet bullet;
- bullet.color = m_color;
- bullet.radius = 3;
- bullet.velocity.x = cos * m_speed;
- bullet.velocity.y = sin * m_speed;
- bullet.position.x = m_position->x + cos * m_shift;
- bullet.position.y = m_position->y + sin * m_shift;
- m_bullets.push_back(std::move(bullet));
- }
- }
-}