# Update animation based on distance traveled instead of elapsed time?

2D sprite Animation is supposed to be based on the elapsed time from the previous update so that it runs (and looks the same) no matter the speed of the machine/device it's running on.

The method that moves my game objects already takes into account the elapsed time. The distance the object moves during updates is the elapsed time (delta) * the objects velocity.

Because the object's location changes based on the elapsed time, would it look (/run the same on all machines) passing the "distance delta" to my Animation update method instead of the delta time? The distance delta would be a number of pixels. Using the distance would ensure my frame animation lines up with how far the object has traveled.

• OK, I figured it would work since the Animation class would be the exact same no matter if it was a long time or distance. Thanks. – SmokeyTehBear Apr 12 '15 at 15:08