Well, in my game the player can walk around the house from imagebuttons, simplified example below:
Code: Select all
label map_house_exterior:
scene house_exterior
call screen map_house_exterior_buttons
screen map_house_exterior_buttons:
# front door
imagebutton:
xpos 660
ypos 650
style "alpha_buttons"
idle "map/house_exterior_zdoor_idle.png"
hover "map/house_exterior_zdoor_hover.png"
action Jump("map_house_dining")
tooltip "{size=24}Enter your home.{/size}"
$ tooltip = GetTooltip()
if GetTooltip() is not None:
text GetTooltip() at pos_tooltips
My problem: although this works perfectly for walking around the house, things start to get complex when I start adding events. For example, let's say at one point, the door is locked, or the door leads to an event X now, but after another condition, to an event Y. This will force me to make this code increasingly complex, eg:
Code: Select all
label map_house_exterior:
scene house_exterior
call screen map_house_exterior_buttons
screen map_house_exterior_buttons:
if not X:
# front door
imagebutton:
xpos 660
ypos 650
style "alpha_buttons"
idle "map/house_exterior_zdoor_idle.png"
hover "map/house_exterior_zdoor_hover.png"
action Jump("map_house_dining")
tooltip "{size=24}Enter your home.{/size}"
if X and not Y:
# front door is locked
imagebutton:
xpos 660
ypos 650
style "alpha_buttons"
idle "map/house_exterior_zdoor_idle.png"
hover "map/house_exterior_zdoor_hover.png"
action Jump("map_house_dining_event_locked")
tooltip "{size=24}Enter your home.{/size}"
if Y and not Z:
# front door send to event 1
imagebutton:
xpos 660
ypos 650
style "alpha_buttons"
idle "map/house_exterior_zdoor_idle.png"
hover "map/house_exterior_zdoor_hover.png"
action Jump("map_house_dining_event1")
tooltip "{size=24}Enter your home.{/size}"
$ tooltip = GetTooltip()
if GetTooltip() is not None:
text GetTooltip() at pos_tooltips