Hello all. I have recently started playing around with SFML. I have found an excellent tutorial online and I am working through it. The tutorial was written for version 1.6 to be used for microsoft visual 2010. However I am using microsoft visual 2013 and i have installed version 2.3.1 I have been modifying the code and all seems to to work reasonably well. However I am stuck with these lines of code here:
void PlayerPaddle::Update(float elapsedTime)
{
if (Game::GetInput().IsKeyDown(sf::Keyboard::Left))
{
_velocity -= 3.0f;
}
if (Game::GetInput().IsKeyDown(sf::Keyboard::Right))
{
_velocity += 3.0f;
}
if (Game::GetInput().IsKeyDown(sf::Keyboard::Down))
{
_velocity = 0.0f;
}
if (_velocity > _maxVelocity)
_velocity = _maxVelocity;
if (_velocity < -_maxVelocity)
_velocity = -_maxVelocity;
sf::Vector2f pos = this->GetPosition();
if (pos.x < GetSprite().GetSize().x / 2
|| pos.x >(Game::SCREEN_WIDTH - GetSprite().GetSize().x / 2))
{
_velocity = -_velocity; // Bounce by current velocity in opposite direction
}
GetSprite().Move(_velocity * elapsedTime, 0);
}
I am reading through the documentation in order to create a suitable modification. But in order to speed up my build does anybody have an existing solution to this. Has this problem been solved already?