SFML community forums
Help => General => Topic started by: TwoFingeredPointer on August 31, 2015, 01:42:17 am
-
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?
-
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?
A solution to what? I don't see any problem, apart from following a tutorial for a very old version of SFML.
Use sf::Keyboard? Read the 2.3 tutorials? Or search (http://en.sfml-dev.org/forums/index.php?topic=5817.msg44468#msg44468)?
-
You have already posted a thread (http://en.sfml-dev.org/forums/index.php?topic=18886) about this old tutorial and converting it to the new version of SFML. Are the official SFML tutorials (http://www.sfml-dev.org/tutorials) not enough?
You must think that this 1.6 tutorial has something that others do not. Would it be possible for you to inform us which tutorial you are using?