How to add rotation to dialogue text?[SOLVED]

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
ReDZiX
Regular
Posts: 32
Joined: Thu Jan 04, 2018 12:42 pm
Contact:

How to add rotation to dialogue text?[SOLVED]

#1 Post by ReDZiX »

Okay, maybe this is a stupid question, but I've been trying for hours and I can't find a solution.

For our game we want to use a stylish dialogue box similar to the one used in Persona 5, with the text slightly inclined to the left. So I'm trying to add some rotation properties to the dialogue text. The only way I've found to do that is to use rotate transform property, so:

Code: Select all

transform txt_rotate(g): 
    rotate g #Rotate displayable by g angle
    
screen say(who, what):
    # Not pasting all the contents of say screen to save space
    
    window:
            text what id "what" at txt_rotate(-4) 
            #Text should be displayed slightly inclined to the left.
This worked perfectly fine in a custom test screen, but in the say screen, the text doesn't appear anywhere. I'm guessing the transform is somehow nulling the default style properties of text but, I thought style and transform where applied independently? Am I doing this the wrong way?
Last edited by ReDZiX on Wed Feb 14, 2018 1:04 pm, edited 1 time in total.

irredeemable
Regular
Posts: 78
Joined: Thu Feb 08, 2018 7:57 am
Contact:

Re: How to add rotation to dialogue text?

#2 Post by irredeemable »

I just tried your code and it worked without issue. Did you maybe make some other changes to the say screen, accidental or otherwise?

irredeemable
Regular
Posts: 78
Joined: Thu Feb 08, 2018 7:57 am
Contact:

Re: How to add rotation to dialogue text?

#3 Post by irredeemable »

I happened to be testing something else with your code still in and realized that the text gets more deformed the longer it is--I had only tested with single words. I found a work-around for it, though, try adding:

Code: Select all

transform_anchor True yanchor 0
as the first line of your transform.

ReDZiX
Regular
Posts: 32
Joined: Thu Jan 04, 2018 12:42 pm
Contact:

Re: How to add rotation to dialogue text?

#4 Post by ReDZiX »

irredeemable wrote: Tue Feb 13, 2018 7:57 pm I happened to be testing something else with your code still in and realized that the text gets more deformed the longer it is--I had only tested with single words. I found a work-around for it, though, try adding:

Code: Select all

transform_anchor True yanchor 0
as the first line of your transform.
Just as you said the problem happened with large amounts of text, I later on re-read the documentation and realized I had to set xanchor and yanchor to 0.5 or else the position would randomly change depending on the size of text; that seemed to fix it, but I'll be sure to test your variant too, seems better.

Thanks a lot!

Post Reply

Who is online

Users browsing this forum: Dark79, Google [Bot], Majestic-12 [Bot]