I\'m messing around with Pygame, making some simple games just to learn it. However, I\'m having a hard time implementing fps the way that I want.
From what I unders
While @monkey's answer is the complete datadump, you should probably have a look over the pygame docs on time.Clock
again. The optional framerate argument to Clock.tick()
sets a ceiling on FPS, not a fixed FPS; in other words, if your game loop takes longer than that amount of time to complete, the game will lag if you are assuming that passing that value ensures a fixed game speed. It looks like Clock.get_time()
and Clock.get_raw_time()
are the things to use to get the execution time of the last game loop, then you can calculate the behavior of your game elements from that.