Different textbox position depending on the situation
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.
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.
- Adrian_DVL
- Regular
- Posts: 114
- Joined: Fri Mar 15, 2019 8:46 am
- Completed: Clockwork Poison
- Projects: Melodic Dates, Clockwork Poison: Salvation
- Contact:
Different textbox position depending on the situation
Hi!
I'd like to change the position of the textbox depending on the situation, and by it I don't mean that I want three or four different positions and neither do I mean I want different characters to have different positions for their textbox, because I'd already know how to do it.
The thing is that my game consists in screens that have sprites of people that appear in different positions, so I want a small textbox to appear next to the sprite, whatever its position is, and changing the position at times for the same character.
I guess I have to mess with window_xpos and window_ypos when defining characters, but I don't see the way to do it without having to define one character per each situation, which would be a pain in the ass.
I've tried to set two variables and to change them each time and to set window_xpos and window_ypos to those variables, but that doesn't work, presumably because characters are objects of a class and I can't change a field like that.
Anyone has an idea? I'd appreciate any help!
I'd like to change the position of the textbox depending on the situation, and by it I don't mean that I want three or four different positions and neither do I mean I want different characters to have different positions for their textbox, because I'd already know how to do it.
The thing is that my game consists in screens that have sprites of people that appear in different positions, so I want a small textbox to appear next to the sprite, whatever its position is, and changing the position at times for the same character.
I guess I have to mess with window_xpos and window_ypos when defining characters, but I don't see the way to do it without having to define one character per each situation, which would be a pain in the ass.
I've tried to set two variables and to change them each time and to set window_xpos and window_ypos to those variables, but that doesn't work, presumably because characters are objects of a class and I can't change a field like that.
Anyone has an idea? I'd appreciate any help!
Re: Different textbox position depending on the situation
Also, you can make custom screen to use instead of standard say screen. But you'll have to mess up with styles a bit...
Code: Select all
define e = Character("Eileen", who_style='my_say_label', what_style='my_say_dialogue', screen='my_scr')
style my_frame:
xminimum 400
yalign 0.0
style my_say_label:
align (0.0, 0.5)
xminimum 400
style my_say_dialogue:
align (0.0, 0.0)
xminimum 400
screen my_scr(who, what):
style_prefix 'my'
frame:
align(my_x_align, my_y_align)
xsize 400
yminimum 200
vbox:
yminimum 200
align(0.5, 0.05)
if who:
frame:
background Solid("#c0c0c055")
text who size 35 id "who"
frame:
background Solid("#c5c5c577")
text what id "what"
# The game starts here.
label start:
$ my_x_align, my_y_align = round(renpy.random.random(), 1), round(renpy.random.random(), 1)
"([my_x_align], [my_y_align])"
e "Line 1"
e "Line 2"
e "Looooooooong Line of text.\nBlah-Blah-Blah\n...\nLooooooooong Line of text.\nBlah-Blah-Blah\n...\nLooooooooong Line of text.\nBlah-Blah-Blah\n...\nLooooooooong Line of text.\nBlah-Blah-Blah\n...\n?"
jump start- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Different textbox position depending on the situation
You could adapt my Speech Bubble dialogue system to your needs...
https://github.com/RenpyRemix/speech-bubbles
https://github.com/RenpyRemix/speech-bubbles
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: Different textbox position depending on the situation
Why it's not in a cookbook?...))Remix wrote: ↑Thu Jan 28, 2021 3:28 pmYou could adapt my Speech Bubble dialogue system to your needs...
https://github.com/RenpyRemix/speech-bubbles
- Adrian_DVL
- Regular
- Posts: 114
- Joined: Fri Mar 15, 2019 8:46 am
- Completed: Clockwork Poison
- Projects: Melodic Dates, Clockwork Poison: Salvation
- Contact:
Re: Different textbox position depending on the situation
Your system made my day, man! Thank you so much!Remix wrote: ↑Thu Jan 28, 2021 3:28 pmYou could adapt my Speech Bubble dialogue system to your needs...
https://github.com/RenpyRemix/speech-bubbles
Also, thanks to _ticlock_ and Alex as always!
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Different textbox position depending on the situation
On the agenda at some point... time permitting...
Did hope to add several more snippets and then start a cookbook like Tom's one (just a listing of them all in one thread, updated when new ones appear)...
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Who is online
Users browsing this forum: Google [Bot]
