Hello there. I'm new to both coding and renpy. Currently I'm trying to make my own game, but there's something I can't figure out. How do you change main menu buttons placement?
For example: http://cdn.akamai.steamstatic.com/steam ... 1461001559. As you can see, the buttons are at the bottom. I'd like to do that but I can't find a line. In screens.rpy there's like xalign line but there isn't yaling so the text only moves vertically. I found some tutorials online but they're outdated. Thanks for help in advance.
Main Menu Question
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.
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.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
- Contact:
Re: Main Menu Question
Using the new GUI, I cannot honestly help as I'm yet to adapt to it, using the old GUI, I'd suggest using an imagebutton.
Try this, it was designed for a game that was 800*600, so just adjust the numbers. xpos is horizontal position (from left), ypos is vertical position(from top).
Then all you have to do is draw the actual images, make two copies for each. One named "filename_hover.png" and one called "filename_idle.png" that will make up your buttons. Save them inside your images folder. You can add any kind of button you need. As you can see, mine includes a "cg" button, this is for a CG gallery - something renpy doesn't come with by default.
idle is what your buttons will look like when your mouse is not covering them, hover is what it looks like when your mouse is over the button.
All thats left, is to reposition them and make sure they don't overlap.
Try this, it was designed for a game that was 800*600, so just adjust the numbers. xpos is horizontal position (from left), ypos is vertical position(from top).
Code: Select all
# Main Menu
screen main_menu():
add "#000" ## Background
tag menu
imagebutton auto "begin_%s.png" xpos 400 ypos 3 focus_mask True action Start()
imagebutton auto "load_%s.png" xpos 400 ypos 108 focus_mask True action ShowMenu("load")
imagebutton auto "cg_%s.png" xpos 400 ypos 213 action ShowMenu("cg_gallery")
imagebutton auto "options_%s.png" xpos 400 ypos 318 action ShowMenu("preferences")
imagebutton auto "help_%s.png" xpos 400 ypos 423 action Help()
imagebutton auto "quit_%s.png" xpos 400 ypos 528 action Quit(confirm=False)
idle is what your buttons will look like when your mouse is not covering them, hover is what it looks like when your mouse is over the button.
All thats left, is to reposition them and make sure they don't overlap.
Re: Main Menu Question
Thanks for the help, I really appreciate it. However, I use the new GUI so I have no idea if it'll work.
- Divona
- Miko-Class Veteran
- Posts: 678
- Joined: Sun Jun 05, 2016 8:29 pm
- Completed: The Falconers: Moonlight
- Organization: Bionic Penguin
- itch: bionicpenguin
- Contact:
Re: Main Menu Question
It will work in new GUI. Here a link to a documentation on Imagebutton: https://www.renpy.org/doc/html/screens. ... magebuttonreve wrote:Thanks for the help, I really appreciate it. However, I use the new GUI so I have no idea if it'll work.
For your information, the main menu and game menu buttons in new GUI are reside in "screen navigation()" within "screens.rpy".
Since "screen navigation()" is using in both main menu and game menu, you should remove "use navigation" line from "screen main_menu()" and add in your own buttons. So it won't affect the rest of the menu, if you want to keep the other menu navigation as is.
For button alignment like in the screenshot, I suggest using Hbox, and add Imagebutton or Textbutton inside:
Code: Select all
screen main_menu():
# This ensures that any other menu screen is replaced.
tag menu
style_prefix "main_menu"
# Add background
add Solid("#000")
hbox:
# Position this hbox to the bottom center of the screen.
xalign 0.5
yalign 0.9
# The spacing between members of this box, in pixels.
spacing 20
# Buttons on Main Menu. You can replace them with imagebutton if you wish.
textbutton _("Start") action Start()
textbutton _("Load") action ShowMenu("load")
textbutton _("Preferences") action ShowMenu("preferences")
textbutton _("About") action ShowMenu("about")
textbutton _("Quit") action Quit(confirm=not main_menu)
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], minyan
