From c437b7ffeebd1112259db7853105ae87844ef45a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arvid=20Sj=C3=B6blom?= Date: Mon, 11 Dec 2023 09:45:51 +0100 Subject: [PATCH] cleanup Bike_enemy --- src/Bike_enemy.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Bike_enemy.cc b/src/Bike_enemy.cc index 360866b..f74f92c 100644 --- a/src/Bike_enemy.cc +++ b/src/Bike_enemy.cc @@ -5,7 +5,12 @@ #include "constants.h" #include "Context.h" -Bike_enemy::Bike_enemy(sf::Texture& txtr, json& params) : max_speed{params["max_speed"]}, elapsed_time{0}, start_x{0}, sin_amplitude{params["sin_amplitude"]}, sin_omega{params["sin_omega"]} +Bike_enemy::Bike_enemy(sf::Texture& txtr, json& params) : + max_speed{params["max_speed"]}, + elapsed_time{0}, + start_x{0}, + sin_amplitude{params["sin_amplitude"]}, + sin_omega{params["sin_omega"]} { direction = {params["direction"][0], params["direction"][1]}; texture = txtr; @@ -28,7 +33,6 @@ void Bike_enemy::collision_enemy() void Bike_enemy::update(Context& context) { - //Game_state* game = static_cast(context.current_state.get()); elapsed_time += context.time.asSeconds(); position += direction*max_speed; position.x = start_x + (sin_amplitude * sin(sin_omega * elapsed_time)); @@ -37,4 +41,4 @@ void Bike_enemy::update(Context& context) void Bike_enemy::render(sf::RenderWindow &window) const { window.draw(sprite); -} +} \ No newline at end of file -- 2.30.2