I have a screen full of imagebuttons and hotspots. When I click on those, they jump to a label.
Thing is, I noticed that jumping to a label hides the screens, which makes the game look silly visually when the screens' buttons are part of the background.
So I created another screen, with the same imagebuttons with a "Return()" action and put that screen on a custom layer so it can be behnd the character's sprite when on the label. I know there're better solutions but I'm a newbie with newbie skills.
Problem is, I can't seem to be able to hide that screen anymore ? Imagebutton's action "Hide" doesnt seem to be working, neither does a simple "hide screen" inside a label.
Here's the whole code + some pics :
Code: Select all
init:
define config.layers = ['blscreen', 'background', 'buttons', 'master', 'transient', 'screens', 'overlay']
### Defined new layers so the buttons are always on screen and unclickable whenever there's some text
### "Background" is for the bg, "buttons" is for the unclickable screens behind the characters
### ...and "Master" is for the sprites. Normal clickable screens are on the "screen" layer.
label pre_mapstart_after_prologue:
$ renpy.music.play("audio/ost_fissa_outskirts.ogg", "music", if_changed=True)
scene bg pre_mapstart onlayer background with dissolve
call screen pre_mapstart_hotspot with fastdissolve
### The "hub" of the scene, where all the clickable areas are
### This label always looks fine
###
label pre_mapstart_embleme:
$ renpy.show_screen("pre_mapstart_hotspot_ib", _layer="buttons")
a "A stylized fairy. The emblem of Perineam."
hide screen pre_mapstart_hotspot_ib
call screen pre_mapstart_hotspot
with fastdissolve
label pre_mapstart_queendom:
$ renpy.show_screen("pre_mapstart_hotspot_ib", _layer="buttons")
a "Deep in this dank, dimly lit cave lies the Fairy Queendom."
hide screen pre_mapstart_hotspot_ib
call screen pre_mapstart_hotspot
with fastdissolve
### Labels "pre_mapstart_embleme" and "pre_mapstart_queendom" are the labels for what
### the screen "pre_mapstart_hotspot_ib" has been created. Since screens disappear after jumping to a label,
### and since I didn't want to bother making the buttons of screen "pre_mapstart_hotspot" unclickable and visible
### with a "if/else" statement (I'm not smart enough) I created a new screen containing the same imagebuttons
### with a Return() action, that I've put on top of the label.
### I've put a "hide screen pre_mapstart_hotspot_ib" at the end of the label to make sure screen "pre_mapstart_hotspot_ib"
### and "pre_mapstart_hotspot" would not be visible at the same time. Doesn't seem to do much.
label pre_mapstart_porte:
show bg door_finished_routes onlayer background with dissolve
a "This door... I recognize this craft..."
call screen pre_mapstart_hotspot
with fastdissolve
### This label has another background. That's where I got my screens were not hiding as I wanted
screen pre_mapstart_hotspot():
imagemap:
ground "bg/bg_pre_mapstart2.png"
hotspot (330, 317, 160, 288): #porte
mouse "loupe_hover"
action [Hide("pre_mapstart_hotspot_ib"), Jump("pre_mapstart_porte")]
hotspot (747, 300, 252, 301): #Fairy Queendom
mouse "loupe_hover"
clicked Jump("pre_mapstart_queendom")
hotspot (800, 122, 90, 88): #Emblème
mouse "loupe_hover"
clicked Jump("pre_mapstart_embleme")
hotspot (217, 667, 467, 50): #Vers Mapstart
mouse "icon_go_hover"
action [Hide("pre_mapstart_hotspot_ib"), Jump("mapstart")]
imagebutton:
focus_mask True
xpos 650
ypos 230
idle "animated_torche"
action NullAction()
if garlandmapstart == True:
imagebutton:
focus_mask True
xpos 100
ypos 230
idle "imagebuttons/ib_garland.png"
action Jump("garland_conv")
elif beatrice_appears_1 == True:
imagebutton:
focus_mask True
xpos 180
ypos 230
idle "beavole"
action Jump("beatrice_1_premapstart")
### The screen containing the imagebuttons and hotspots
screen pre_mapstart_hotspot_ib():
imagebutton:
focus_mask True
xpos 650
ypos 230
idle "animated_torche"
action Return()
if garlandmapstart == True:
imagebutton:
focus_mask True
xpos 100
ypos 230
idle "imagebuttons/ib_garland2.png"
action Return()
elif beatrice_appears_1 == True:
imagebutton:
focus_mask True
xpos 180
ypos 230
idle "beavole"
action Return()
### The screen containing the unclickable imagebuttons, visible during dialogue.
### I've colored the dude in purple here, to check which screen was the trouble-maker, as the buttons are visually the same.