#include <iostream>
-Helper::Helper(json& params) : stop_bot{params["stop_bot"]}, stop_top{params["stop_top"]}, max_speed{params["max_speed"]}
+Helper::Helper(json& params) : stop_bot{params["stop_bot"]}, stop_top{params["stop_top"]}, max_speed{params["max_speed"]}, movement{}
{
position = {params["start_pos"][0], params["start_pos"][1]};
direction = {params["direction"][0], params["direction"][1]};
+ movement = direction;
texture.loadFromFile("assets/ysex.png");
sprite.setTexture(texture);
void Helper::move(bool forward)
{
- position += static_cast<float>(pow(-1, forward - 1)) * direction * max_speed;
- if (position.y >= stop_bot || position.y <= stop_top )
+ position += static_cast<float>(pow(-1, forward - 1)) * movement * max_speed;
+ if (position.y >= stop_bot)
{
- direction *= -1.0f;
+ movement = direction * -1.0f;
+ }
+ else if (position.y <= stop_top)
+ {
+ movement = direction;
}
sprite.setPosition(position);
}
float stop_bot;
float stop_top;
float max_speed;
+ sf::Vector2f movement;
};
#endif
\ No newline at end of file
// game_state is still managed by context
//Game_state* game = static_cast<Game_state*>(context.current_state.get());
move();
-
- return;
}
void Player::move(bool forward)
time_since_last_bottle = 0;
}
game_map->update(points);
- player->update(context);
- helper->update(context);
enemy->update(context);
}
--- /dev/null
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Addr1
+ ...
+ obj:/usr/lib/x86_64-linux-gnu/libsfml-*
+ ...
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Addr2
+ ...
+ obj:/usr/lib/x86_64-linux-gnu/libsfml-*
+ ...
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Addr4
+ ...
+ obj:/usr/lib/x86_64-linux-gnu/libsfml-*
+ ...
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Addr8
+ ...
+ obj:/usr/lib/x86_64-linux-gnu/libsfml-*
+ ...
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Addr1
+ ...
+ obj:/usr/lib/x86_64-linux-gnu/dri/*
+ ...
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Addr2
+ ...
+ obj:/usr/lib/x86_64-linux-gnu/dri/*
+ ...
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Addr4
+ ...
+ obj:/usr/lib/x86_64-linux-gnu/dri/*
+ ...
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Addr8
+ ...
+ obj:/usr/lib/x86_64-linux-gnu/dri/*
+ ...
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ ...
+ obj:/usr/lib/x86_64-linux-gnu/dri/*
+ ...
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Cond
+ ...
+ obj:/usr/lib/x86_64-linux-gnu/dri/*
+ ...
+}
\ No newline at end of file