adding imagebutton to Main Menu

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
pronehouse
Newbie
Posts: 8
Joined: Sun Jun 24, 2018 4:06 am
Contact:

adding imagebutton to Main Menu

#1 Post by pronehouse »

I give up. I've tried every piece of code I've found online to add an imagebutton to the Main Menu of my game and nothing seems to work. Please, help?

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: adding imagebutton to Main Menu

#2 Post by rayminator »

can you please add your code that you were trying to use

try something like this
the number are where you want the button to appear at
Your_folder is where you have put the images into
and ShowMenu("Your_Gallery_Page") is where you want to go to or you can use this also click("Your_Gallery_Page")

Code: Select all

imagebutton idle im.Scale("Your_folder/1.png", 129, 250) hover im.Scale("Your_folder/1b.png", 129, 250) action ShowMenu("Your_Gallery_Page")

pronehouse
Newbie
Posts: 8
Joined: Sun Jun 24, 2018 4:06 am
Contact:

Re: adding imagebutton to Main Menu

#3 Post by pronehouse »

Thank you man.
Essentially I need an imagebutton under the regular navigation textbuttons. I'm not sure where to place it in the screens.
So esentially, I go to screens and I write at the end of the navigation screen part:

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") action Start()
            

        else:

            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)
            
        vbox xalign 0.5 yalign 0.5:
            imagebutton auto ("gui/button/thingie.png") action OpenURL("http://whatever.com")
 	
Which only gives me an error.

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: adding imagebutton to Main Menu

#4 Post by rayminator »

try this

Code: Select all

imagebutton xalign 0.5 yalign 0.5:
            idle ("gui/button/thingie.png")
            action OpenURL("http://whatever.com")
I have tried it and it works

pronehouse
Newbie
Posts: 8
Joined: Sun Jun 24, 2018 4:06 am
Contact:

Re: adding imagebutton to Main Menu

#5 Post by pronehouse »

Oh.
Oh!
So it was that easy!
Can't thank you enough, man. A thousand thanks.

Post Reply

Who is online

Users browsing this forum: Google [Bot]