Recently, we found in the Development of TD games that the moving objects in the game are quite different in the android simulator and the real machine.
For example, if the FPS on the simulator is 10 and the FPS on the real machine is 50, the object moving speed on the simulator will be very slow, but the real machine will run very fast.
How can we avoid the impact of machine performance on the moving speed of objects? In fact, it is also relatively simple, as long as you give the object a moving speed (with direction), and then record the time interval between the previous frame and the current frame, multiply by 0.001 to seconds.
The moving speed * time interval is used to determine the distance between each object to be moved. In this way, on machines with better performance, the time interval between each frame will be relatively short, and the moving speed will become smoother.
// Delta time interval public void Update (long delta) {// The moving distance from the X coordinate to centerx + = speed * (DIR) * Delta * 0.001 ;}