From 4c3eca4427841730501b24b25cc4ff2a36f9f070 Mon Sep 17 00:00:00 2001 From: Michal Date: Sun, 24 Apr 2022 19:26:25 +0200 Subject: Fix spiral movement --- Spiral.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Spiral.cpp') diff --git a/Spiral.cpp b/Spiral.cpp index 636a6b2..cfa02c6 100644 --- a/Spiral.cpp +++ b/Spiral.cpp @@ -28,10 +28,11 @@ SpiralSystem::update(const float dt) bullet.angle -= 2.0; bullet.redirect *= bullet.redirect_decrease; } - float velovity_x = std::cos(angle * M_PI); - float velovity_y = std::sin(angle * M_PI); + float velocity_x = bullet.velocity * std::cos(bullet.angle * M_PI); + float velocity_y = bullet.velocity * std::sin(bullet.angle * M_PI); bullet.position.x += velocity_x * dt; bullet.position.y += velocity_y * dt; + //bullet.position.x += 5*dt; const bool y_exceeded = bullet.position.y < min_height || bullet.position.y > max_height; const bool x_exceeded = bullet.position.x < min_width || bullet.position.x > max_width; if (y_exceeded || x_exceeded) -- cgit v1.1