From: Arvid Sjöblom Date: Mon, 11 Dec 2023 08:45:51 +0000 (+0100) Subject: cleanup Bike_enemy X-Git-Url: https://gitweb.forssennils.se/?a=commitdiff_plain;h=c437b7ffeebd1112259db7853105ae87844ef45a;p=TDDC76_proj.git cleanup Bike_enemy --- 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