Correcting Timer

So, I have a game with a timer, but if the game lags that causes the player to move slower, causing the timer to be incorrect. I can get the game’s frames (Always → Number (+) → Number (Set) Timer into the “Get input”), but is there a way to use the fps the game is running at and adjust the timers time based on that? So if the game is running slow at 20 fps the timer will adjust for that?
I was thinking of getting the percent of the frames ((Frames/60)*100), then multiplying the time for that second by that amount, would that work, or is there a better way to do this?

1 Like

The timer doesn’t depend on frame rate, so I’m not sure I understand what’s going on. If you set a timer for 30 seconds, it will trigger in 30 seconds whether 100 frames have elapsed, or 1000.

2 Likes

The timer is correct, but game physics slow down. Making my object move slower than it’s supposed to.

1 Like

It sounds like the ideal fix would be to figure out why the physics are running slow and fix that though, right? Maybe I’m just not understanding, though.

To answer your question: if you only care about “game time” (elapsed frames) and not “clock time”, then you can do like you suggested and just increment a Number with an Always. That will keep an accurate count of how many frames have elapsed, and you can display that as a sort of “Timer” if that’s closer to what you need.

2 Likes

That should work should work with a few modifications, ty for the quick response.