So I am coding a game in pygame, and Came across the problem, that the framerate can speed/slow things down at different parts of the game. I am well aware of the option to cap the frame rate, but I also have an idea that I am not quite sure if it would work. Would it be possible, instead of caping the max. framerate, you let it go as high as it can and add a multiplier which changes according to the framerate? For example: If you play with 100 fps and your character moves 10 pixels at a time, you would move 100*(1* 10) = 1000 pixels per second, and if the game runs on 200 fps, the character would still move with 200*(0.5*10) = 1000 pixels at a time. Is this possible/ does this work?
Asked
Active
Viewed 10 times
0
-
Honestly this sounds like a great idea. I don't see any reason why this would not work – Jon_Kle Sep 24 '22 at 21:22
-
See [Framerate affect the speed of the game](https://stackoverflow.com/questions/61352366/framerate-affect-the-speed-of-the-game): `move_pixel_per_frame = move_pixel_per_second * milliseconds_frame / 1000` – Rabbid76 Sep 24 '22 at 21:44