Moving Namebox Based on Textbox Height?

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
ConerNSFW
Regular
Posts: 40
Joined: Sun Oct 23, 2016 5:08 pm
Contact:

Moving Namebox Based on Textbox Height?

#1 Post by ConerNSFW » Fri Sep 08, 2017 11:08 am

So I've made a custom screen for a charater and put the textbox inside a frame and set the yanchor to the bottom of the screen like so:

Code: Select all

screen player(who, what):
    style_prefix "say"

    window:
        id "window"

        if who is not None:

            window:
                xpadding 10
                style "namebox"
                text who id "who"
        frame:
            xpadding 10
            ypadding 10
            yanchor 1.0
            background Frame("gui/textbox.png")
            text what id "what"
And it works great except that the namebox is still stuck in place, I want to display the namebox just above the textbox so when there is a linebreak and the textbox increases in height the namebox will move up to compensate for it.

User avatar
Kia
Eileen-Class Veteran
Posts: 1011
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: Moving Namebox Based on Textbox Height?

#2 Post by Kia » Sat Sep 09, 2017 11:24 am

you can put both your text and namebox in a vbox
as the dialogue shrink the box shrinks and the namebox moves to the right position

ConerNSFW
Regular
Posts: 40
Joined: Sun Oct 23, 2016 5:08 pm
Contact:

Re: Moving Namebox Based on Textbox Height?

#3 Post by ConerNSFW » Sat Sep 09, 2017 8:57 pm

That worked, thanks.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Hojoo