#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;
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));
void Bike_enemy::render(sf::RenderWindow &window) const
{
window.draw(sprite);
-}
+}
\ No newline at end of file