choice buttons minimmumY Spacing is posible?

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
johandark
Veteran
Posts: 355
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

choice buttons minimmumY Spacing is posible?

#1 Post by johandark »

Image

Is the a posibility to put higher the choice buttons so it doesn´t go over the text below? Like a minimmum Y where questions can´t go lower...

Also would be nice to have the ability of space between questions would be variable depending on the space available... I don´t know if it´s possible...

Thanks!
Image

User avatar
johandark
Veteran
Posts: 355
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

Re: choice buttons minimmumY Spacing is posible?

#2 Post by johandark »

Is it not possible? :S
Image

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: choice buttons minimmumY Spacing is posible?

#3 Post by Alex »

It's definitelly possible. If you use a new gui, then in gui.rpy find this line

Code: Select all

## The spacing between menu choices.
define gui.choice_spacing = 22
If you use legacy theme, then you need to modify choice screen a bit: in screens.rpy find the part anout choice screen

Code: Select all

screen choice(items):

    window:
        style "menu_window"
        xalign 0.5
        yalign 0.5

        vbox:
            style "menu"
            spacing 2 # <--- change the number to some variable, and don't forget to set it using define statement
etc. 
https://www.renpy.org/doc/html/python.h ... statement

User avatar
carrot
Regular
Posts: 28
Joined: Fri Jul 28, 2017 7:43 am
Contact:

Re: choice buttons minimmumY Spacing is posible?

#4 Post by carrot »

You can change the Y position of the choice section by changing "ypos" in the "choice screen" section of screens.rpy:

Code: Select all

style choice_vbox:
    xalign 0.5
    ypos 275     		# change this, a lower number will place it higher on the screen
    yanchor 0.5  		# you can also change this if you want to position from the top of the box, rather than the middle

    spacing gui.choice_spacing 	# REMOVE THIS LINE
To get dynamic spacing, you can remove the 'spacing gui.choice_spacing' line from the section above, and instead specify the spacing in this section (this section is just above the previous section):

Code: Select all

screen choice(items):
    style_prefix "choice"

    $ space = 50 / len(items)		# calculate spacing depending on the number of items
    vbox spacing space:			# specify that spacing when creating the vbox
        for i in items:
            textbutton i.caption action i.action
Although obviously you'll want to work out a better value, the formula I've used is just to demonstrate that it works.

Post Reply

Who is online

Users browsing this forum: No registered users