Hello! I have some problem with my player movement (i use vector2 to calculate the position) and the framerate of the game.
i see that if I run the game in my phone at 60fps the play jump the right height, but if i play the game in a phone with 30fps the play jump a lot too height.
i don’t understand why it appened, con somebody explain to me how i can resolve or how it works?
thanks in advice and sorry for my dab english
FPS correlates to how often the game loop (render()) is running, which things like jump height that rely on it will run at a different rate on each computer, unless you use delta timing which is very simple in libgdx (already implemented for you):
public void move(float delta) {
x += 2 * delta;
}
You can obtain the delta variable from the render loop.
thanks for the rapid answer, if I do my_vector.scl(delta) is the same thing?
I don’t see how the FPS should in any way determine how high the player is able to jump. The time it takes for the player to reach that height could vary, though.
How are you handling how the player jumps? I don’t see how it should be related to the frame rate. I would just set the player’s velocity when jumping, and increment the position based on velocity * deltaTime. The downwards velocity (due to acceleration by gravity) should also be multiplied by the delta time.
Damn, I missed that, just read “moving” :persecutioncomplex: