Complex menu transitions.

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
User avatar
K-PSZH
Regular
Posts: 37
Joined: Sun May 15, 2022 10:34 am
Soundcloud: K-PSZH
Location: Russia
Contact:

Complex menu transitions.

#1 Post by K-PSZH »

By now I have two screens:

Code: Select all

screen main_menu(): 
    tag menu
    add "gui/main_menu.png"
    add "gui/main_menu/title.png"
    add "gui/main_menu/element.png"
    imagebutton auto "gui/main_menu/main_menu_start_%s.png": 
        action ShowMenu("preferences", _transition = dissolve)

Code: Select all

screen preferences():
    tag menu
    modal True
    add "gui/game_menu/prefs_bg.png"
    add "gui/game_menu/game_menu.png"
What I want to implement is, for example, when you pressing the button and transition from main menu to game menu starts, title.png becomes a little smaller, element.png wipes to right and game_menu.png wipes from left.
How such a complex transition can be implemented? Maybe it would be easier to make everything in same screen?
Missing/forgetting a lot of simplest things and ask about them here.

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Complex menu transitions.

#2 Post by _ticlock_ »

K-PSZH wrote: Sun Nov 27, 2022 4:09 am What I want to implement is, for example, when you pressing the button and transition from main menu to game menu starts, title.png becomes a little smaller, element.png wipes to right and game_menu.png wipes from left.
How such a complex transition can be implemented? Maybe it would be easier to make everything in same screen?
Transitions are used for the whole screen/scene. If you want to move, change particular elements you can use transforms. Check this documentation page(Animation and Transformation Language).

You can use on show and on hide statements to trigger specific transform when changing screens. You can use if statements to check which transform to apply. Rough example for title.png

Code: Select all

transform title_transform:
    on show:
        zoom 1.0 
        xalign 0.5 
        yalign 0.0
        linear 1.0 zoom 0.5

screen preferences():
    tag menu
    
    add "gui/main_menu/title.png":
        if some_condition_to_check_if_title_transform_is_needed:
            at title_transform
It is not hard to write the transforms that you mentioned, the harder part is to trigger them only when you need them. You probably want a specific transform when player comes from game or game_menu. You can track it with some variable or maybe pass argument to the menu:

Code: Select all

ShowMenu("preferences", some_condition = True)
...
screen preferences(some_condition= False):

Post Reply

Who is online

Users browsing this forum: Google [Bot]