Page 1 of 2

How to move menu buttons?

Posted: Thu Oct 05, 2017 11:24 am
by Ace94
Hi. I've looked about everywhere I could possibly look and haven't found a single guide on how to do this.... All the guides that I saw were on the previous update of Ren'py and I am making a game on the new one.

How can I move the game menu buttons? I want them to show horizontally like this:
http://78.media.tumblr.com/6328f1612fd4 ... 1_1280.png

Also how to remove or add an additional button? Like removing Credits for example. Thanks in advance!

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 11:37 am
by RicharDann
If you go to screens.rpy and scroll to the navigation screen, the menu buttons are organized inside a vbox, that's a vertical box, it displays its children vertically. Instead you can use an hbox (horizontal). As for adding or removing buttons, it's as simple as deleting them in the code and writing new ones. For example:

Code: Select all

screen navigation():

    hbox:
        style_prefix "navigation"

        xpos gui.navigation_xpos
        yalign 0.5

        spacing 30

        if main_menu:

            textbutton _("Start") action Start()
            
        else:
                       
            textbutton _("Save") action ShowMenu("save")
            
        textbutton _("Load") action ShowMenu("load")

        textbutton _("Prefs") action ShowMenu("preferences")

        textbutton _("Quit") action Quit()

The documentation has a lot of useful information and examples, and is always up to date.

https://www.renpy.org/doc/html/screens.html

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 11:47 am
by Ace94
Thank you very much! I got it done immediately with your help! If I need more help on this should I create a new topic or just post in the same one?

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 11:53 am
by RicharDann
Glad I could help! :)

And yes, if what you need help with still relates to the topic title, or if the solution we give doesn't solve the problem, you can post it right here, if it's a different problem that requires additional explanation you may want to create a new topic with a different title.

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 11:59 am
by Ace94
Okay, I got one real fast: To allign it in the bottom center like the image shown in the first post, do I change something on this line of code?
"spacing gui.navigation_spacing"

edit: I already changed yalign to be 1.0 and that puts it in the bottom, but not the centre.

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 12:07 pm
by RicharDann
EDIT: Oops, I misunderstood your question. To place it in the bottom center you need to change yalign to something like 0.7

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 12:14 pm
by Ace94
Yeah I changed that, but it's aligned on the left side of the screen, doesn't look to be in the center.

edit: like this: https://i.gyazo.com/df559146f220cad3ff5 ... 3a2871.png

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 12:23 pm
by RicharDann
Ah, of course, you also have to change xalign to 0.5

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 12:25 pm
by Ace94
Oh I just figured it out lol! But the confusing part is that there was no xalign in the code, so I was searching for that. I wrote it myself and it worked like a charm. Thank you so much!

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 2:04 pm
by Ace94
Another question: Can I customize the navigation menu buttons to be an image and make another image with different color when hovering over a button or it has to be done with font and html colors?

edit: I guess with this?

screen gui_game_menu():
vbox xalign 1.0 yalign 1.0:
imagebutton auto "save_%s.png" action ShowMenu('save')
imagebutton auto "prefs_%s.png" action ShowMenu('preferences')
imagebutton auto "skip_%s.png" action Skip()
imagebutton auto "afm_%s.png" action Preference("auto-forward mode", "toggle")

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 2:58 pm
by RicharDann
Ace94 wrote: Thu Oct 05, 2017 2:04 pm Another question: Can I customize the navigation menu buttons to be an image and make another image with different color when hovering over a button or it has to be done with font and html colors?

edit: I guess with this?

screen gui_game_menu():
vbox xalign 1.0 yalign 1.0:
imagebutton auto "save_%s.png" action ShowMenu('save')
imagebutton auto "prefs_%s.png" action ShowMenu('preferences')
imagebutton auto "skip_%s.png" action Skip()
imagebutton auto "afm_%s.png" action Preference("auto-forward mode", "toggle")
Yes, your guess is right :D You need to have all those images in your images folder, so for example for the save button you need at least two images called save_idle.png and save_hover.png, each you can customize however you want, just make sure both are the same size.

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 4:54 pm
by Ace94
RicharDann wrote: Thu Oct 05, 2017 2:58 pm
Ace94 wrote: Thu Oct 05, 2017 2:04 pm Another question: Can I customize the navigation menu buttons to be an image and make another image with different color when hovering over a button or it has to be done with font and html colors?

edit: I guess with this?

screen gui_game_menu():
vbox xalign 1.0 yalign 1.0:
imagebutton auto "save_%s.png" action ShowMenu('save')
imagebutton auto "prefs_%s.png" action ShowMenu('preferences')
imagebutton auto "skip_%s.png" action Skip()
imagebutton auto "afm_%s.png" action Preference("auto-forward mode", "toggle")
Yes, your guess is right :D You need to have all those images in your images folder, so for example for the save button you need at least two images called save_idle.png and save_hover.png, each you can customize however you want, just make sure both are the same size.
I seem to be stuck at this for some reason.... can you tell me what I am doing wrong?

This is what code I use for the "LOAD" image as an imagebutton and when I launch the game with the code like this, it just disappears and there is no load anywhere.

screen navigation():

hbox:
style_prefix "navigation"

xpos gui.navigation_xpos
xalign -0.2
yalign 0.95

spacing gui.navigation_spacing

if main_menu:

textbutton _("Start") action Start()

else:

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

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

imagebutton idle "load_idle.png" action ShowMenu("load")
imagebutton hover "load_hover.png" action ShowMenu("load")

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 7:40 pm
by Imperf3kt
You are trying to use two imagebuttons, delete one.

Code: Select all

imagebutton auto "load_%s.png" focus_mask True action ShowMenu("load")
## or
imagebutton idle "load_idle.png" hover "load_hover.png" focus_mask True action ShowMenu("load")

Re: How to move menu buttons?

Posted: Thu Oct 05, 2017 10:20 pm
by Ace94
Imperf3kt wrote: Thu Oct 05, 2017 7:40 pm You are trying to use two imagebuttons, delete one.
Thank you for the reply! Your suggestion worked and the button appeared, however, after I add a Start imagebutton, I try to add another imagebutton, for example the Load one in the else statement and nothing appears other than the Start imagebutton when I launch the game itself. Not even the text buttons show after I change the Start one. Any idea what I am doing wrong?

Re: How to move menu buttons?

Posted: Fri Oct 06, 2017 9:28 am
by RicharDann
There might be a problem with identation, or the way you're placing the buttons, it's hard to know for sure without actually seeing the code. If you can post the entire screen code formatted using [code] [/code]tags, like this

Code: Select all


# Your code here