"Another thing you can do is just use Clock to limit the FPS to 60 or
something, but then your game will run slower if you're not getting 60
fps."
Well, true, but you MUST determine the framerate that you want for
your game, otherway you will get a 60 FPS in your PC, 70 in another
and 120 in another one that is much more faster/newer than yours and
in witch your game will turn unusable at this framerate....
I do this:
while(true): #principal loop
# get current time
t = time.time()
....
doAll()
....
#At the end i get the time needed to do the calculatons & flip
T = t - time.time()
delta = T - 1/desiredFrameRate
if (delta > 0): # if the cycle has been done too fast
time.wait(delta)
####This way you have your desired framerate or the maximum
possible. Additionally you can do this:
else:
GLOBAL_T = GLOBAL_STANDAR_T - delta # delta is <= 0, - and - is +
Being GLOBAL_T the t that you use for your position calculations and
global_standar_t the value of global_t if delta is 0.