[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Framerate Normalizer



Hello,
I have a game, written in pygame, but it now needs to support more framerates.
The movements of objects need to be at the same speed, regardless of the framerate.
Here is an old line:

self.thrust = 0.0075

Here is the new line.  The game was developed on my computer at 198 fps (IdealFPS), but now needs to be scaled to a lower one for use on alternate computers (TargetFPS).  The theory here is to multiply this rate by IdealFPS to give the distance moved in one second, then divide this difference by the number of frames in second there will really be. (TargetFPS).

self.thrust = (0.0075*IdealFPS)/TargetFPS

Unfortunately, this doesn't work--the movement doesn't scale properly.  Any ideas why?
Thanks,
Ian