Not Just Paranoid

Another site by Pete Maynard

Frame rate independent movement in PyGame

To make sure that your game runs the same on all computers that can handle it. You will need to make sure that your actions are independent from the frame rate. To do this in python you can put this code above the game loop

framerate = 60 #frames per second clock = pygame.time.Clock()

and then at the end of your game loop put

timepassed = clock.tick(framerate)

This should help with makeing the game more playable ^_^ Hope this helps.

19 Aug 2009 | Tags ( game dev Programming PyGame Python )

Website Last Updated on 15 Sep 2023 (CC BY-SA 4.0)

This site uses JQuery and nanogallery2 hosted by
for the Flickr photo feed and GoatCounter for user insights.