Create Timer.py
Pulled it out of GameLogic class. Makes sense to keep it separate.
This commit is contained in:
parent
b11f77f7ef
commit
7b486881d9
18
Timer.py
Normal file
18
Timer.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
from datetime import datetime, time
|
||||||
|
|
||||||
|
class Timer():
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.startTime = 0
|
||||||
|
|
||||||
|
|
||||||
|
def has_second_passed(self):
|
||||||
|
return self.get_time() > 1
|
||||||
|
|
||||||
|
|
||||||
|
def get_time(self):
|
||||||
|
return str(datetime.now() - self.startTime)
|
||||||
|
|
||||||
|
|
||||||
|
def reset_time(self):
|
||||||
|
self.startTime = datetime.now()
|
Loading…
Reference in New Issue
Block a user