I have labels for different locations that change the scene when jumped to, and imagebuttons for things like doors that jump to them when clicked. I'm not sure if it's the right way to do it, but I put "$ renpy.pause(hard=True)" at the end of the location labels to allow the player to "move" around. It seems to work great so far. I also have a working time system, and an imagebutton that advances time by an increment of 1.
The problem is that whenever I use the TimeForward button to advance time, it also transports me back and forth between the bedroom and the hallway with each click. I've tried changing different things, and sometimes it changes which "rooms" I'm transported to. If I change the "jump bedroom" to "jump hallway" under the start label, it no longer bounces me back and forth, but it transports me back to the hallway if I'm in the bedroom. I think the problem may have something to do with the TimeForward button "bypassing" the pauses? I tried putting "$ renpy.pause(hard=True)" at the end of the "timechange" label, that stops the "transporting" but also stops the background images from changing with the time of day.
Hopefully that makes some sense, basically I'm trying to get the player to be able to navigate to different "rooms" by clicking on imagebuttons, and also to be able to advance time by clicking on other imagebuttons, but not to transport them to random rooms when clicking the advance time buttons. I'm sure it's a stupid problem, but I have no idea what I should be doing differently. Here is the full script for the game so far. It's not very long, I'm trying to get everything working before I add more stuff. I'd really appreciate it if someone who knows what they're doing could give me a hint as to what I'm doing wrong. Thank you in advance for any help.
Code: Select all
define p = Character("Player")
# Time
label timechange(increment=1):
$ timeofdaynumber += increment
if timeofdaynumber == 1:
$ timeofday = " Early Morning"
elif timeofdaynumber == 2:
$ timeofday = "Mid Morning"
elif timeofdaynumber == 3:
$ timeofday = "Late Morning"
elif timeofdaynumber == 4:
$ timeofday = "Early Day"
elif timeofdaynumber == 5:
$ timeofday = "Mid Day"
elif timeofdaynumber == 6:
$ timeofday = "Late Day"
elif timeofdaynumber == 7:
$ timeofday = "Early Evening"
elif timeofdaynumber == 8:
$ timeofday = "Mid Evening"
elif timeofdaynumber == 9:
$ timeofday = "Late Evening"
elif timeofdaynumber == 10:
$ timeofday = "Early Night"
elif timeofdaynumber == 11:
$ timeofday = "Mid Night"
elif timeofdaynumber == 12:
$ timeofday = "Late Night"
elif timeofdaynumber >= 13:
$ timeofdaynumber = 1
$ timeofday = "Morning"
$ dayofweeknumber += 1
$ totaldaysnumber += 1
$ monthday += 1
if dayofweeknumber == 1:
$ dayofweek = "Monday"
elif dayofweeknumber == 2:
$ dayofweek = "Tuesday"
elif dayofweeknumber == 3:
$ dayofweek = "Wenesday"
elif dayofweeknumber == 4:
$ dayofweek = "Thursday"
elif dayofweeknumber == 5:
$ dayofweek = "Friday"
elif dayofweeknumber == 6:
$ dayofweek = "Saturday"
elif dayofweeknumber == 7:
$ dayofweek = "Sunday"
elif dayofweeknumber >= 8:
$ dayofweeknumber = 1
else:
$ timeofday = "ERROR"
if totaldaysnumber == 1:
$ monthday = 1
$ month = "January"
elif totaldaysnumber == 31:
$ monthday = 1
$ month = "February"
elif totaldaysnumber == 59:
$ monthday = 1
$ month = "March"
elif totaldaysnumber == 90:
$ monthday = 1
$ month = "April"
elif totaldaysnumber == 120:
$ monthday = 1
$ month = "May"
elif totaldaysnumber == 151:
$ monthday = 1
$ month = "June"
elif totaldaysnumber == 181:
$ monthday = 1
$ month = "July"
elif totaldaysnumber == 212:
$ monthday = 1
$ month = "August"
elif totaldaysnumber == 243:
$ monthday = 1
$ month = "September"
elif totaldaysnumber == 273:
$ monthday = 1
$ month = "October"
elif totaldaysnumber == 304:
$ monthday = 1
$ month = "November"
elif totaldaysnumber == 334:
$ monthday = 1
$ month = "December"
elif totaldaysnumber >= 366:
$ monthday = 1
$ month = "January"
return
default timeofdaynumber = 1
default timeofday = "Early Morning"
default dayofweeknumber = 1
default dayofweek = "Monday"
default totaldaysnumber = 1
default monthday = 1
default month = "January"
screen TimeDisplay:
text "[timeofday]" ypos 0.85 xpos 0.05
text "[dayofweek]" ypos 0.9 xpos 0.05
text "[month] [monthday]" ypos 0.8 xpos 0.05
screen TimeForward:
imagebutton:
pos (936, 11, 83, 79)
idle "time_forward"
hover "time_forward_hover"
action Call("timechange")
# Locations
screen button_home_bedroom_door():
layer "master"
imagebutton:
if timeofdaynumber >= 7:
idle "button_home_bedroom_door_night"
else:
idle "button_home_bedroom_door_day"
if timeofdaynumber >= 7:
hover "button_home_bedroom_door_night_hover"
else:
hover "button_home_bedroom_door_day_hover"
pos (225, 188, 184, 340)
action Jump("hallway")
screen button_home_hallway_door_01():
layer "master"
imagebutton:
if timeofdaynumber >= 7:
idle "button_home_hallway_door_01_night"
else:
idle "button_home_hallway_door_01_day"
if timeofdaynumber >= 7:
hover "button_home_hallway_door_01_night_hover"
else:
hover "button_home_hallway_door_01_day_hover"
pos (176, 281, 127, 242)
action Jump("bedroom")
label bedroom:
if timeofdaynumber >= 7:
show location_home_bedroom_evening
else:
show location_home_bedroom_day
show screen button_home_bedroom_door
$ renpy.pause(hard=True)
label hallway:
if timeofdaynumber >= 7:
scene location_home_hallway_night
else:
scene location_home_hallway_day
show screen button_home_hallway_door_01
$ renpy.pause(hard=True)
# Game Start
label start:
show screen TimeDisplay
show screen TimeForward
jump bedroom
p "testing!"
return