16
General / Re: Correct way to do player movement
« on: April 19, 2012, 02:21:11 am »
In this case, deltatime should be the time of one frame. So you have to calculate it correctly.
Declare "deltatime" out of the main loop.
http://www.koonsolo.com/news/dewitters-gameloop/
Declare "deltatime" out of the main loop.
clock.restart();
//events...
deltatime = clock.getElapsedTime().asSeconds();
For more advanced loop, you could use a fixed timestep. This tutorial explains it very well://events...
deltatime = clock.getElapsedTime().asSeconds();
http://www.koonsolo.com/news/dewitters-gameloop/