Correct if I’m wrong please ;D
If I want to limit my game to 30FPS for example I can use frame based timing for update the position and the animation of my sprites.
public void update() {
x += dx;
y += dy;
// updates the animation (go to the next frame)
anim.update();
}
But if I want to run my game at full speed I will use time based instead of frame based, so:
public void update(long elapsedTime) {
x += dx * elapsedTime;
y += dy * elapsedTime;
// updates the animation (go to the next frame)
anim.update(elapsedTime);
}
Questions:
- Is that correct?
- Is time based suitable for 2D games?
- How can I mantain the smoothness of the movement and animation of the sprites in time based?
Tks