Main Menu Label

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Main Menu Label

#1 Post by wyverngem »

I wanted to share a bit of code that might help someone in the future. It's about working with the main_menu label. In this label you can bypass the default or customize it to add a little more character to your main menu.

To simply bypass the main_menu you can leave the main_menu blank. This will cause you to skip the main_menu and go straight for the label start. When you run out of content under the start label it will jump back to the main_menu. Since the main_menu label is blank it will appear to be an endless loop. Keep in mind this doesn't set a background when you do this.

Code: Select all

label main_menu:
    return
You can also use it to make an animated main_menu with images and text. You can set something up like this.

Code: Select all

label main_menu:
    scene black #Set a background image for this screen
    if testingcheats: #Skip the main_menu if you're testing the game.
        return
    # The new main menu
    "It wasn't just a dream."
    show clara at mm
    $ renpy.pause(1, hard=True)#Allows transform mm to play
    show title at truecenter with dissolve
    call screen custom_main_menu
    #Everything after screen only plays if screen action is dismissed or action returns null.
    show clara at happyhearts
    $ renpy.pause(3, hard=True)
    hide title with dissolve
    hide clara with moveoutleft
    return
A few things to keep in mind when creating these;
- If you use text they will not be added to the History, if you have it
- When using transforms remember to hard pause after the show to allow for the animations to play. Otherwise they will not appear to play.
- You can create your own fully custom_main_menu screen with this code. Make sure to set the modal to true so you don't skip over the screen.
- If you have only a custom main menu and use actions like ShowMenu("save") it will show the default screen and main_menu. Keep that in mind you can customize thos screens as well.
- On your custom_main_menu you can make your Start button return with the action Null, and it will play everything after the call screen. If you use Start() or ShowMenu() these will be skipped. Start will wipe the screen with the default transition and ShowMenu() will show the menu screen. If you're using defaults it will use the main_menu without a returning to your screen.
- If the player returns to the main_menu from game it will display everything in order from the top. So keep that in mind for length. You can combine it with a splashscreen label to have a fancier animation that plays only once per game load (and not reloads).

I hope this helps someone in the future.

Post Reply

Who is online

Users browsing this forum: No registered users