- Aug 13, 2019
- 1,898
- 2,923
I'm trying to set a really simple calendar system that would only display the day of the week and the current hour. The plan is just for it to be displayed, since it's kind of relevant to the context of the game, and also to use it to display variants of the backgrounds.
This indeed displays the time correctly, and I can advance time with the specific commands, but I have a few problems with this.
Python:
init python:
class calendar(object):
def __init__(self):
self.day = 1
self.hour = 1
self.weekdays = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
self.time_of_day = ["8:00 A.M.", "12:00 P.M.", "4:00 P.M.", "8:00 P.M.", "12:00 A.M."]
@property
def weekday(self):
return self.weekdays[(self.day-1)%7]
@property
def time(self):
return self.time_of_day[(self.hour-1)%5]
def advance_weekday(self):
self.day += 1
def advance_time(self):
self.hour += 1
default clock = calendar()
screen clock_marker:
add "time_display.png" xalign 0.0 yalign 0.0
vbox:
xalign 0.0
yalign 0.0
spacing 5
textbutton "{b}[clock.weekday]{/b}"
textbutton "{b}[clock.time]{/b}"
- If I want it to go forward, I have to input "$ clock.advance_time()" a couple of times. I tried "$ clock.advance_time(2)" so the value doubles, but doesn't work that way, it seems.
- Additionally, I would rather set an specific hour rather than just advance it, since, again, is relevant to the plot.
- I'm not exactly sure how to make the background variants display.
- I also want to round time in a new property that would be morning, noon and night.
Last edited: