Buttons on top [FIXED]

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
leviathanimation
Regular
Posts: 49
Joined: Wed Nov 15, 2017 9:33 pm
Completed: Tyrania visual novel
Projects: Making multiple animations
Deviantart: leviathanimation
itch: leviathanimation
Location: Canada
Contact:

Buttons on top [FIXED]

#1 Post by leviathanimation » Fri Mar 20, 2020 11:07 pm

I changed the navigation screen section to have custom buttons in the main menu. The problem is now when I click on the load button in the main menu, the load screen appears but all the buttons of the main menu are on top of it. Help how do i fix that?
Last edited by leviathanimation on Sat Mar 21, 2020 12:47 pm, edited 1 time in total.
Image

User avatar
Per K Grok
Miko-Class Veteran
Posts: 741
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1 & 2
itch: per-k-grok
Location: Sverige
Contact:

Re: Buttons on top

#2 Post by Per K Grok » Sat Mar 21, 2020 6:48 am

leviathanimation wrote:
Fri Mar 20, 2020 11:07 pm
I changed the navigation screen section to have custom buttons in the main menu. The problem is now when I click on the load button in the main menu, the load screen appears but all the buttons of the main menu are on top of it. Help how do i fix that?
Screen navigation is use by both the Main Menu and the other Game Menu screens, which I assume you already know.

In my experience when you try to customize stuff in the navigation screen just for the main menu, things tend to spill over to the other Game Menu screens for reasons that are not apparent.

The simplest way to handle this, in my opinion, is to make a special navigation screen just for the Main Menu.

User avatar
leviathanimation
Regular
Posts: 49
Joined: Wed Nov 15, 2017 9:33 pm
Completed: Tyrania visual novel
Projects: Making multiple animations
Deviantart: leviathanimation
itch: leviathanimation
Location: Canada
Contact:

Re: Buttons on top

#3 Post by leviathanimation » Sat Mar 21, 2020 11:04 am

I'm still new to coding, so I feel like if I try to create a new navigation screen, things will be worst :( Is there really not a way to just play with the layers of the imagebutton? Like put it at bottom layer or something like that..?
Per K Grok wrote:
Sat Mar 21, 2020 6:48 am
leviathanimation wrote:
Fri Mar 20, 2020 11:07 pm
I changed the navigation screen section to have custom buttons in the main menu. The problem is now when I click on the load button in the main menu, the load screen appears but all the buttons of the main menu are on top of it. Help how do i fix that?
Screen navigation is use by both the Main Menu and the other Game Menu screens, which I assume you already know.

In my experience when you try to customize stuff in the navigation screen just for the main menu, things tend to spill over to the other Game Menu screens for reasons that are not apparent.

The simplest way to handle this, in my opinion, is to make a special navigation screen just for the Main Menu.
Image

User avatar
gas
Miko-Class Veteran
Posts: 718
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Buttons on top

#4 Post by gas » Sat Mar 21, 2020 11:25 am

Apply these changes. In such way you have a navigation for main menu and one for other screens.

NAVIGATION:

Code: Select all

## Navigation screen ###########################################################
screen navigation():

    vbox:
        style_prefix "navigation"

        xpos gui.navigation_xpos
        yalign 0.5

        spacing gui.navigation_spacing


        textbutton _("History") action ShowMenu("history")

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

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

        textbutton _("Preferences") 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"):

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

            ## The quit button is banned on iOS and unnecessary on Android.
            textbutton _("Quit") action Quit(confirm=not main_menu)
Now, in your main menu, delete the 'use navigation' line and insert your buttons. Here I used text buttons, you can do whatever.

Code: Select all

screen main_menu():

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

    style_prefix "main_menu"

    add gui.main_menu_background

    ## This empty frame darkens the main menu.
    frame:
        pass

    vbox:
        style_prefix "navigation"
        textbutton "START" action Start()
        textbutton "LOAD" action ShowMenu("load")
        textbutton "PREFS" action ShowMenu("preferences")
        textbutton "QUIT" action Quit(confirm = False)
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll be not notified about.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
leviathanimation
Regular
Posts: 49
Joined: Wed Nov 15, 2017 9:33 pm
Completed: Tyrania visual novel
Projects: Making multiple animations
Deviantart: leviathanimation
itch: leviathanimation
Location: Canada
Contact:

Re: Buttons on top

#5 Post by leviathanimation » Sat Mar 21, 2020 12:47 pm

OMG Thank you so much!
gas wrote:
Sat Mar 21, 2020 11:25 am
Apply these changes. In such way you have a navigation for main menu and one for other screens.

NAVIGATION:

Code: Select all

## Navigation screen ###########################################################
screen navigation():

    vbox:
        style_prefix "navigation"

        xpos gui.navigation_xpos
        yalign 0.5

        spacing gui.navigation_spacing


        textbutton _("History") action ShowMenu("history")

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

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

        textbutton _("Preferences") 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"):

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

            ## The quit button is banned on iOS and unnecessary on Android.
            textbutton _("Quit") action Quit(confirm=not main_menu)
Now, in your main menu, delete the 'use navigation' line and insert your buttons. Here I used text buttons, you can do whatever.

Code: Select all

screen main_menu():

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

    style_prefix "main_menu"

    add gui.main_menu_background

    ## This empty frame darkens the main menu.
    frame:
        pass

    vbox:
        style_prefix "navigation"
        textbutton "START" action Start()
        textbutton "LOAD" action ShowMenu("load")
        textbutton "PREFS" action ShowMenu("preferences")
        textbutton "QUIT" action Quit(confirm = False)
Image

Post Reply

Who is online

Users browsing this forum: Nanahs