Hi, I'm trying to create first simple game using SFML but while working on player moving I stand upon one problem, function won't work in my class, here is fragment of my code:
void Player::PlayerMoving(int offset_x_min, int offset_x_max, int offset_y, sf::View view, int speed_x, int speed_y, float cameraSpeed) {
//it's keep player on view while camera is moving
if (pos.x <= view.getCenter().x - offset_x_min) {
pos = sf::Vector2f(pos.x += cameraSpeed, pos.y);
}
//pos = viev.getCenter() - sf::Vector2f(offset_x, offset_y);
if ((sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) && (pos.x > view.getCenter().x - offset_x_min))
{
// left key is pressed: move our character
//pos = sf::Vector2f(pos.x -= speed_x, pos.y); //my version of move but it's not fluent
sprite.move(sf::Vector2f(1.f ,0.f));
//sprite.rotate(2); //just for testing and it's working
}
...
I was looking for solution but couldn't find any.