Not able to do text alignment on a panning text field?

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
Sabiwabi
Newbie
Posts: 4
Joined: Tue Jul 14, 2015 11:43 am
Contact:

Not able to do text alignment on a panning text field?

#1 Post by Sabiwabi »

What I am trying to achieve:
I want a large text to slowly pan across the screen, think like an end credits screen, or a low budget version of star wars. Just very simple big ol text block emerging from the bottom of the screen and working its way to the top. Now heres the thing: I want it to be left aligned.


What I did:
Trying to do this as simply as possible I just defined a style...

Code: Select all

style scrollingText_s:
    xalign 0.0
    text_align 0.0
    color "50a832"

and then in scene with the panning text

Code: Select all

show text "{=scrollingText_s} BLA BLA BLA LONG TEXT GOES HERE\n\nAND CONTINUES ON ANOTHER LINE\n\nAND ANOTHER {/=scrollingText_s}":
        xpos 0.5 ypos 1.0
        linear 20.0 ypos -3.0

What I got instead:
No matter what I do the text just does not want to align correctly, it is always centered.
It gets the right color (not used anywhere else) so I know that the text is at least using the style that is defined but I guess I am not telling it to left align its text correctly?

so instead of:
BLA BLA BLA LONG TEXT GOES HERE
AND CONTINUES ON ANOTHER LINE
AND ANOTHER

I get:
BLA BLA BLA LONG TEXT GOES HERE
AND CONTINUES ON ANOTHER LINE
AND ANOTHER

Is there something Im doing wrong? or is there perhaps a simpler way to achieve what I am trying to do?

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

Re: Not able to do text alignment on a panning text field?

#2 Post by Alex »

Sabiwabi wrote: Fri Sep 03, 2021 4:21 pm ...

Code: Select all

show text "{=scrollingText_s} BLA BLA BLA LONG TEXT GOES HERE\n\nAND CONTINUES ON ANOTHER LINE\n\nAND ANOTHER {/=scrollingText_s}":
        xpos 0.5 ypos 1.0 # <--- ?
        linear 20.0 ypos -3.0
...
Why do you set xpos 0.5?

Sabiwabi
Newbie
Posts: 4
Joined: Tue Jul 14, 2015 11:43 am
Contact:

Re: Not able to do text alignment on a panning text field?

#3 Post by Sabiwabi »

That is the position on the screen I want it to be shown, but I don't want the text to be center aligned, I want it to be left aligned.
So a left aligned text in the center of the screen.

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

Re: Not able to do text alignment on a panning text field?

#4 Post by Alex »

Sabiwabi wrote: Sat Sep 04, 2021 6:11 am That is the position on the screen I want it to be shown, but I don't want the text to be center aligned, I want it to be left aligned.
So a left aligned text in the center of the screen.
Well, looks like you need:
- a container,
- left align text inside this container,
- put that container at the center of the screen.

Try it like

Code: Select all

transform scrolling_tr(t=2.0): # you can pass parameter to transform
    yalign 1.0 yanchor 0.0
    linear t yalign 0.0 yanchor 1.0
    
screen scrolling_text_scr(txt='???', show_time=5.0): # you can pass parameter to screen
    frame:
        background None
        xalign 0.5
        at scrolling_tr(show_time) # you can pass parameter to transform
        text txt xalign 0.0
        
    timer (show_time + 0.1) action Hide('scrolling_text_scr') # auto-hiding the screen

# The game starts here.
label start:
    "..."

    show screen scrolling_text_scr(txt='BLA BLA BLA LONG TEXT GOES HERE\n\nAND CONTINUES ON ANOTHER LINE\n\nAND ANOTHER')
    "?!"
https://www.renpy.org/doc/html/screens.html
https://www.renpy.org/doc/html/atl.html

Sabiwabi
Newbie
Posts: 4
Joined: Tue Jul 14, 2015 11:43 am
Contact:

Re: Not able to do text alignment on a panning text field?

#5 Post by Sabiwabi »

Was not aware that you could move containers in that way! Thank you, it seems to do what I need it to do!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], mold.FF