Screen transition without also transitioning used screens? [solved]

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
trailsiderice
Regular
Posts: 69
Joined: Fri Sep 29, 2023 4:02 pm
Contact:

Screen transition without also transitioning used screens? [solved]

#1 Post by trailsiderice »

Is it possible to transition between two screens that share a used screen, without the screen transition animation applying to the used screen?

What I mean is, I have a menu footer, and I want it to be visible no matter what main menu screen I'm on, so it's 'use'd in all my main menu screens. I want to have a fade-to-black transition when moving between main menu screens, so I changed config.intra_transition to fade, but doing so hides the menu sidebar during the transition, and I want it to be visible even during the screen transition. Is it possible to fix that?

Even if I were to give up on the fade-to-black transition, with the default dissolve transition I often don't like the dissolve transition to apply to things on my static footer. I'd like to disable it for the used screen.

I considered trying to add the footer to config.always_shown_screens, but even if that were to work, it wouldn't be a very good solution considering it would also make the footer show during gameplay, which I don't want.
Last edited by trailsiderice on Wed Nov 22, 2023 9:22 pm, edited 1 time in total.

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1118
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Screen transition without also transitioning used screens?

#2 Post by m_from_space »

trailsiderice wrote: Tue Nov 21, 2023 6:03 am I considered trying to add the footer to config.always_shown_screens, but even if that were to work, it wouldn't be a very good solution considering it would also make the footer show during gameplay, which I don't want.
What about just not making the footer part of the main menu screens, but show it by using the special label "before_main_menu"? You can then easily hide the screen when a game starts inside label "start" and also inside the label "after_load", when a player is loading a game. So in the end it's an independent screen.

trailsiderice
Regular
Posts: 69
Joined: Fri Sep 29, 2023 4:02 pm
Contact:

Re: Screen transition without also transitioning used screens?

#3 Post by trailsiderice »

m_from_space wrote: Tue Nov 21, 2023 8:28 am What about just not making the footer part of the main menu screens, but show it by using the special label "before_main_menu"? You can then easily hide the screen when a game starts inside label "start" and also inside the label "after_load", when a player is loading a game. So in the end it's an independent screen.
like this?

Code: Select all

label before_main_menu:
    show screen footer
    
label start:
    hide screen footer
I've just tried this, but it doesn't seem to work. The footer doesn't show at all on any menu now.

There's also the issue that I don't have just one start label—I have my game organized into separate character routes, and each route has it's own separate start label, and as far as I know the game doesn't play the default start label before those.

Interestingly, I tried adding a bit of test dialogue to the start label to see whether or not this was the case, and something strange happened. I added the test dialogue like so:

Code: Select all

label start:
	"test"
	hide screen footer
With this code, going to the main menu shows the footer briefly with the "test" dialogue over it + a black screen, then hides the footer and goes to the main menu with the dialogue window persisting over top of the main menu despite being empty. (And yes, I can now confirm that the default start label does not play when I select a route. It simply goes straight to the start label for that route.) I think it's safe to say this solution will not work for me, at least not written like this.

trailsiderice
Regular
Posts: 69
Joined: Fri Sep 29, 2023 4:02 pm
Contact:

Re: Screen transition without also transitioning used screens?

#4 Post by trailsiderice »

I appreciate the attempt to try and help, m_from_space, even if it didn't quite work. Does anyone else have any suggestions for how I could maybe solve this? Or is it impossible?

Another_Tom
Regular
Posts: 61
Joined: Mon Apr 24, 2023 9:06 am
Completed: Harold And The Witches
Projects: Steven On The Run
itch: dantom
Location: Germany
Contact:

Re: Screen transition without also transitioning used screens?

#5 Post by Another_Tom »

trailsiderice wrote: Wed Nov 22, 2023 5:19 am ...
If I've understood you correctly, you want to have a "Footer" in all menus.
You could add the elements from the screen footer() to the screen navigation(). (To be found in screens.rpy)

Code: Select all

screen navigation():
    vbox:
        style_prefix "navigation"
        xpos gui.navigation_xpos
        yalign 0.5
        spacing gui.navigation_spacing

        if main_menu:
            
            textbutton _("Start new Game") action Start()

        else:

            ## Not necessary anymore for this
            # textbutton _("History") action ShowMenu("history")

            textbutton _("Save Game") action ShowMenu("save")

        textbutton _("Load Game") action ShowMenu("load")

        textbutton _("Options") action ShowMenu("preferences")

        if _in_replay:

            textbutton _("End Replay") action EndReplay(confirm=True)

        elif not main_menu:

            textbutton _("Main Menu") action MainMenu()

        textbutton _("About") action ShowMenu("about")

        if renpy.variant("pc") or (renpy.variant("web") and not renpy.variant("mobile")):

            ## Help isn't necessary or relevant to mobile devices.
            textbutton _("Help") action ShowMenu("help")

        if renpy.variant("pc"):

            ## The quit button is banned on iOS and unnecessary on Android and
            ## Web.
            textbutton _("Exit") action Quit(confirm=not main_menu)

#### add your elements from the screen footer() here
        ## if you add it at this point
        ## it will use the vbox, maybe for a custom button .
        textbutton "my_own_button" action NullAction()
    ## this text will not use the vbox and is centered at the bottom of the screen
    text "This is a Footer, and will not fade if you switch between menus.":
        xalign 0.5 yalign 1.0
Edit: Hope you get what I mean. xD

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1118
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Screen transition without also transitioning used screens?

#6 Post by m_from_space »

trailsiderice wrote: Wed Nov 22, 2023 5:19 am I appreciate the attempt to try and help, m_from_space, even if it didn't quite work. Does anyone else have any suggestions for how I could maybe solve this? Or is it impossible?
Alright, didn't test it beforehand, so sorry for that failed attempt.

But the following works, you may also want to add it to game_menu or wherever you need it. I have not tried any transitions, but I mean it's a separate screen now. Make sure to *not* give that footer screen some "menu" tag of course.

Code: Select all

screen main_menu():
    on "show" action Show("my_footer")
    on "hide" action Hide("my_footer")
    # ...

trailsiderice
Regular
Posts: 69
Joined: Fri Sep 29, 2023 4:02 pm
Contact:

Re: Screen transition without also transitioning used screens?

#7 Post by trailsiderice »

Another_Tom wrote: Wed Nov 22, 2023 8:22 am If I've understood you correctly, you want to have a "Footer" in all menus.
You could add the elements from the screen footer() to the screen navigation(). (To be found in screens.rpy)
Well yes, I do want to have a footer in all menus, but that's not really the root of the problem. The root of the problem is that I want the content of the menu screens to have a transition, without that transition affecting the footer content at all.

In any case I don't know that this will work for me... I've completely removed the navigation screen from my game because I wanted to style all my menus from the ground up. My footer is essentially the replacement for the navigation screen. Although I suppose I could try doing what the default main menu does and use transclude to show other screens, but I'm not sure if that will solve the problem either, since as far as I know even in the default menu transitions defined in config.intra_transition still apply to the navigation...
m_from_space wrote: Wed Nov 22, 2023 12:01 pm Alright, didn't test it beforehand, so sorry for that failed attempt.

But the following works, you may also want to add it to game_menu or wherever you need it. I have not tried any transitions, but I mean it's a separate screen now. Make sure to *not* give that footer screen some "menu" tag of course.
No worries, again I appreciated the effort anyway.

Unfortunately while it does work to show the footer, it seems transitions still apply to it with that code, although I will say it did manage to solve a different, albeit somewhat related problem I was having (I had an animation transform applied to my footer buttons so that they would animate up when selected and animate back down when deselected in order to indicate which menu was active, but unfortunately that resulted in the buttons bouncing whenever the screen changed. using this code instead of use seems to fix that issue) so thanks for fixing that at least!
Last edited by trailsiderice on Wed Nov 22, 2023 9:23 pm, edited 1 time in total.

trailsiderice
Regular
Posts: 69
Joined: Fri Sep 29, 2023 4:02 pm
Contact:

Re: Screen transition without also transitioning used screens?

#8 Post by trailsiderice »

I may be wrong, but I imagine that solving this problem may be a matter of somehow positioning the footer *above* the overlay layer, or otherwise put the footer on a different layer than the main menu and somehow prevent the transition from applying to that layer. I'm going to do a dive into the documentation and see what I can find, and if anyone has any suggestions, please share them!

So far I've found that I could possibly do

Code: Select all

define config.intra_transition = { "screens" : fade }
but then I tried moving the footer to the overlay layer with layer "overlay" but doing that made it disappear. i might try making a custom layer and see if that works.

trailsiderice
Regular
Posts: 69
Joined: Fri Sep 29, 2023 4:02 pm
Contact:

Re: Screen transition without also transitioning used screens?

#9 Post by trailsiderice »

Good news, I found a solution!

instead of layer "overlay" i instead used layer "top". in addition to the dict transition in my above post, this works perfectly!

Ultimately though this solution would not have worked without m_from_space's code, so thank you again for the help you've given!

Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot]