cleanup Bike_enemy
authorArvid Sjöblom <arvsj277@student.liu.se>
Mon, 11 Dec 2023 08:45:51 +0000 (09:45 +0100)
committerArvid Sjöblom <arvsj277@student.liu.se>
Mon, 11 Dec 2023 08:45:51 +0000 (09:45 +0100)
src/Bike_enemy.cc

index 360866b9dbd38a379eb2a2def7b3d71e12dfeb1a..f74f92c377f95a34100fdf4f3fd8e9feae00ddb6 100644 (file)
@@ -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<Game_state*>(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