Pygame time module?

A forum for general discussion of the Python programming language.

Pygame time module?

Postby BlueBeachMonster » Sun Apr 06, 2014 2:18 pm

I need a pygame time module that won't freeze the entire game for the specified time.
Any suggestions?
(Instead of things like: time.sleep(n) or pygame.time.wait(n))
BlueBeachMonster
 
Posts: 5
Joined: Fri Apr 04, 2014 8:33 pm

Re: Pygame time module?

Postby Mekire » Sun Apr 06, 2014 2:43 pm

This seems identical to your other post. Please do not create duplicate posts.

In pygame, for controlling the framerate of the whole program, you create a clock:
Code: Select all
clock = pygame.time.Clock()
Then every frame you call that clocks tick method to limit the game to a specific framerate:
Code: Select all
clock.tick(FPS)

For timing individual events you will want to use:
Code: Select all
pygame.time.get_ticks()

-Mek
User avatar
Mekire
 
Posts: 1149
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 3 guests