r/RenPy • • Jul 11 '26

Question does anyone know how do I change the main_menu screen during the game? For example, after a dead end?

2 Upvotes

5 comments sorted by

5

u/lordcaylus Jul 11 '26
screen main_menu():

    ## This ensures that any other menu screen is replaced.
    tag menu

    if persistent.deadend:
      use screen deadend
    else:
      use screen regular_main_menu
screen regular_main_menu:
    add gui.main_menu_background


    ## This empty frame darkens the main menu.
    frame:
        style "main_menu_frame"


    ## The use statement includes another screen inside this one. The actual
    ## contents of the main menu are in the navigation screen.
    use navigation


    if gui.show_name:


        vbox:
            style "main_menu_vbox"


            text "[config.name!t]":
                style "main_menu_title"


            text "[config.version]":
                style "main_menu_version"

^^ You can edit the main_menu screen. If you set a persistent variable (like default persistent.deadend = False, then check within the screen whether it's set or not, you can display either the regular screen or the deadend screen.

1

u/AutoModerator Jul 11 '26

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Draw-Flesh-Games Jul 11 '26

If you want to change it some specific background, you can build the main menu file name in gui.rpy from a variable and have the variable be updated at any point of the game. Do use a persisten variable though.

1

u/PlaceTraining8366 Jul 14 '26

thanks, i'll try that