Replies: 2 comments
-
The phrase "Why is this still framerate-dependent when I'm simulating an unstable FPS with SetTargetFPS()?" is probably pointing to a misunderstanding about SetTargetFPS. Please see an answer to a similar question here #4201 (comment) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Sorry, forgot to answer this. I fixed it by squaring delta in some places, acceleration is weird. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have some movement code that applies friction to/decays X velocity (
player->velocity.x = expdy(player->velocity.x, 0, 20, delta);
, whereexpdy(a, b, decay, dt)
is the exponential decay function, TL;DR smooth curve), adds to the velocity when the player presses keys (IsKeyDown(KEY_LEFT) -> player->velocity.x -= 80;
), and adds it to the position scaled by delta (player->pos = Vector2Add(player->pos, Vector2Scale(player->velocity, delta));
.This is done before using a drawing function such as
BeginDrawing()
orBeginTextureMode()
, but still in the process loop. I have seperated functions for processing and drawing. Why is this still framerate-dependent when I'm simulating an unstable FPS withSetTargetFPS()
?It seems to work as expected when I add directly to
player->pos
, which is even stranger.This is most probably a stupid question, and I'm missing something very obvious.
Beta Was this translation helpful? Give feedback.
All reactions