Reputation: 13
I already read the post over here but it's different than my question.
I'm making a game, the game's main ingredient is a countdown timer (no character moving, no map only a timer) - and I'm looking for a way that I could update the screen globally every millisecond to the current time.
My question is, should I give up on having it update every millisecond or is there any way to take care of it this? Using time
or just maybe pygame.Clock
- if there's another way of doing a countdown timer (while in game, so it won't influence the FPS, please let me know).
Upvotes: 1
Views: 1374
Reputation: 7036
Yes this is possible using the pygame.time.Clock. You just use the tick
method with the fps that you want. But keep in mind you are only going to see updates as fast as your screen refreshes.
clock = pygame.time.Clock()
while True:
clock.tick(1000) # waits until the next ms
#clear your frame here
#update and draw your text here
#flip your display window here
Upvotes: 0