Renpy question - how to layer screens

Ryder77

Member
Game Developer
Sep 9, 2017
462
384
I'm trying to figure out how to layer different screens. I have a HUD, which I want to always been on top, and a number of other screens (imagemaps) which I want to call while keeping the HUD screen on top. I've tried adding the config.layers and using the onlayer command, but it doesn't seem to work for screens. Ideally, I'd like to set up the HUD screen on top and just forget about it.

Any advice would be much appreciated.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,361
15,271
Ideally, I'd like to set up the HUD screen on top and just forget about it.
There's so many different way to do this... Some better that other, depending of what you effectively plan to do. Among them, and assuming that the HUD screen is name "HUD" :

You can define it as an overlay with . It's a "do and forget" easy approach, and at anytime you can decide if you'll show it with the boolean suppress_overlay (but it will show/hide all the overlays).
Code:
    $ config.overlay_screens.append( "HUD" )
You can add it in the screens you display, with the screen statement.
Code:
screen myMainScreen( image ):
    frame:
        text "something"
        add image
        [...]

    use HUD
Or you can simply display it with show screen. The screen will stay displayed until you explicitly hide it, or show a screen with the same . Just ensure that you used the property to ensure that the screen will stay on top of the rest.
 

Ryder77

Member
Game Developer
Sep 9, 2017
462
384
Thank you so much. This is exactly what I am looking for.

I guess the "onlayer" command doesn't apply to screens?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,361
15,271
I guess the "onlayer" command doesn't apply to screens?
It's something different. To summarize, it's used by Ren'py to build the what you'll see. It add the image one layer after the other, starting by the less significant one (the one that can be covered by all the others).
You can use it with screens, by using the property of the screen language, but it's not necessarily the best way to define a (semi-)persistent screen.

[Edit: I messed with one of the icode tags]
 
Last edited:
  • Like
Reactions: Vanderer

Ryder77

Member
Game Developer
Sep 9, 2017
462
384
I see. Well, the zorder suggestion you had worked perfectly, so thanks again. :)