From c1c7fb82aed0c403865896a941388a9e2cc486d0 Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 25 Apr 2022 01:49:48 +0200 Subject: Extended test staged with new enemies --- ExampleGenerator.cpp | 55 ---------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 ExampleGenerator.cpp (limited to 'ExampleGenerator.cpp') diff --git a/ExampleGenerator.cpp b/ExampleGenerator.cpp deleted file mode 100644 index f405f58..0000000 --- a/ExampleGenerator.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "ExampleGenerator.h" - -#include -#include -#include - -#include - -#include "ConstantVelocity.h" - - -ExampleGenerator::ExampleGenerator(std::shared_ptr position, ConstantVelocityBullet::Vector& bullets) : - m_position {position}, - m_bullets {bullets}, - m_delay {0}, - m_interval {0.08f}, - m_cone {0.4f}, - m_angle {0.5f}, - m_direction {-1.f}, - m_speed {80}, - m_shift {10}, - m_segments {6}, - m_color {240, 0, 0, 255} -{ -} - - -void -ExampleGenerator::update(const float dt) -{ - if (!m_enabled) - return; - m_delay += dt; - if (m_delay > m_interval) { - m_delay -= m_interval; - m_color.g = 0; - for (float i = 0; i <= m_segments; ++i) { - const float angle = (m_angle - m_cone / 2 + m_cone * i / m_segments) * 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)); - m_color.g += 20; - } - } - m_angle += dt * 0.3f * m_direction; - if (m_angle > 2.f) - m_angle -= 2.f; -} -- cgit v1.1