Why my player doesent move smooth?
while(renderWindow->isOpen())
{
sf::Clock elapsedTime;
sf::Event renderWindowEvent;
while(renderWindow->pollEvent(renderWindowEvent))
{
handleEvent(renderWindowEvent);
}
update(elapsedTime.getElapsedTime());
renderWindow->clear(backgroundColor);
render(*new sf::SpriteBatch(renderWindow));
renderWindow->display();
}
if(sf::Keyboard::isKeyPressed(sf::Keyboard::D))
{
pos.x += 1000 * elapsedTime.asSeconds();
}
if(sf::Keyboard::isKeyPressed(sf::Keyboard::A))
{
pos.x -= 1000 * elapsedTime.asSeconds();
}
I got the most time, if I print the time out as Seconds 3.25-e-005.
Whats that and how I can fix that?
Normal the player should in that case move 1000 pixels per seconds, but he doesent.
Please help.