Positioning in game menu buttons

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
jadeon12
Newbie
Posts: 24
Joined: Sat Mar 05, 2016 6:17 am
Contact:

Positioning in game menu buttons

#1 Post by jadeon12 »

Hello fellow Renpy users.

I have 2 questions concerning the menu choices buttons.
When the choices appear the buttons are placed by default around the center of the window.

1.How can we change the placement of menu buttons?
like with the attached picture i want the menu buttons to appear on the characters head instead of in-front.

2.How to shrink the buttons length?
Right now it is a very long blue box, if one wants it to be shorter or the same fit as the text inside.
Attachments
renpy.png

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Positioning in game menu buttons

#2 Post by IrinaLazareva »

use screen choice in screens.rpy file:

Code: Select all

screen choice:

    window:
        style "menu_window"
        xalign 0.5 ##<< to change the placement of menu
        yalign 0.5 ##<<

        vbox:
            style "menu"
            spacing 2

            for caption, action, chosen in items:

                if action:

                    button:
                        action action
                        style "menu_choice_button"
                        xysize(300,10) ##<<add this for changing the size of buttons 
                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"
https://www.renpy.org/doc/html/screen_s ... tml#choice

jadeon12
Newbie
Posts: 24
Joined: Sat Mar 05, 2016 6:17 am
Contact:

Re: Positioning in game menu buttons

#3 Post by jadeon12 »

IrinaLazareva wrote:use screen choice in screens.rpy file:

Code: Select all

screen choice:

    window:
        style "menu_window"
        xalign 0.5 ##<< to change the placement of menu
        yalign 0.5 ##<<

        vbox:
            style "menu"
            spacing 2

            for caption, action, chosen in items:

                if action:

                    button:
                        action action
                        style "menu_choice_button"
                        xysize(300,10) ##<<add this for changing the size of buttons 
                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"
https://www.renpy.org/doc/html/screen_s ... tml#choice

Thank you friend.
it works i can widen and shorten the buttons also.

but all the other menu buttons show up in that position, how can i do it for this particular menu only. leaving the others in default position?

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Positioning in game menu buttons

#4 Post by IrinaLazareva »

jadeon12 wrote: but all the other menu buttons show up in that position, how can i do it for this particular menu only. leaving the others in default position?

I supose that there is simpler decision...
anyway, in screens.rpy:

Code: Select all

screen choice:
    window:
        style "menu_window"
        if gala:
            xalign 0.9 ##<< special menu
            yalign 0.5 ##<< special menu
        else:
            xalign 0.5 ##<< simple menu
            yalign 0.5 ##<< simple menu
#....
in script.rpy:

Code: Select all

define gala = False 
label start:

    menu:
        "this is a simple menu"
        "choise 1":
            pass
        "choise 2":
            pass
    $ gala = True
    menu:
        "and that is the special menu"
        "choise 3":
            pass
        "choise 4":
            pass    
    $ gala = False
    menu:
        "a simple menu, again"
        "choise 5":
            pass
        "choise 6":
            pass

Post Reply

Who is online

Users browsing this forum: Bing [Bot], decocloud, Ocelot