experimenting with pygame timer and looking for a way to pause the timer, and start the timer again from the previous time.
Functions like pygame.time.get_ticks()
work to record time from the start of the application.
Functions like delay
or wait
freezes the program. I don't want that.
Is there a simple way to keep track a timer object, pause it when I need to and continue it when I need?
def timer(self):
self.time = (pygame.time.get_ticks()//1000)
self.time = self.time - self.pausetime
return self.time
self.pausetime = (pygame.time.get_ticks()//1000)
The above will not work because event if self.pausetime
is a different variable defined at a different time, it will still return the amount of time since the start of the application.
I think I need a pause
variable that I can set to zero every time I come from a pause.
Any thoughts or easy ways I might have over looked?