Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
2

Having problem with ingame clock

Ryoto
Ryoto

I was creating an in-game clock where for every minute, an hour passes. This is the code:

class timeSpan:

def __init__ (self, waitTime): self.waitTime = waitTime self.currentTime datetime.datetime.now().totalSeconds() def ready (self): if currentTime + waitTime <= datetime.datetime.now().totalSeconds() currentTime += waitTime return True return False

class clock:
timer = timeSpan(1)
minutes = 0
hours = 0
days = 0
def tick:
if timer.ready():
minutes += 1
if not(minutes %= 60):
hours++
if not(hours %= 24):
days += 1

However, the computer said that datetime.datetime.now().totalSeconds()
was invalid syntax. Could you please help me with this problem?

1 year ago

Voters