I want to have text bubbles where I also will keep the standard text box (the default one) when there are instructions. There will be three types of text bubble forms - while speaking, screaming, thinking. And the position will be "fixed" mostly I want to create 8 different position (lets say my monitor is a grid with 9 slots I don't need only the middle one) what is the best way to do something like this?
So far my idea is a method with a variable for the position (0-8, based on the position), for the text bubble type (0-3), bubble arrow (0-4, bot left, bot right, top left, top right), string one for the text. Where 0 will be the standard box.
Is there a better or easier way to do it? Or something where the bubbles will not be fixed to these positions?
Text bubbles based on type and position?
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.
-
- Newbie
- Posts: 2
- Joined: Thu Jun 14, 2018 12:31 pm
- Contact:
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Text bubbles based on type and position?
I have used word balloons in my game "Defenders of Adacan, part 1"Mr12Inches wrote: ↑Sun May 17, 2020 1:03 pm I want to have text bubbles where I also will keep the standard text box (the default one) when there are instructions. There will be three types of text bubble forms - while speaking, screaming, thinking. And the position will be "fixed" mostly I want to create 8 different position (lets say my monitor is a grid with 9 slots I don't need only the middle one) what is the best way to do something like this?
So far my idea is a method with a variable for the position (0-8, based on the position), for the text bubble type (0-3), bubble arrow (0-4, bot left, bot right, top left, top right), string one for the text. Where 0 will be the standard box.
Is there a better or easier way to do it? Or something where the bubbles will not be fixed to these positions?
And I am using an modified version in my WIP game "Defenders of Adacan, part 2"
The basic difference is that the earlier model has fixed size balloons with fixed tails.
The newer will adjust size of the balloon from the length of the text string and tails are added as a separate part.
In both cases the balloon is placed using an x, y position.
The system consists of
1.a screen with the balloon,
2. a callable label that shows the balloon, adds text to history and finally hides the balloon, and
3. calls when a characters speaks
This is the code I use for the screen
Code: Select all
screen balloon(what, x, y, a, t, who):
if a<10:
$ b=125
$ c=110
$ d=20
elif a<25:
$ b=150
$ c=110
$ d=25
elif a<45:
$ b=220
$ c=130
$ d=25
elif a<110:
$ b=270
$ c=180
$ d=30
else:
$ b=340
$ c=200
$ d=30
frame:
pos (x, y)
xmaximum b
ymaximum c
padding (d,d)
if who=="Erkilgul":
background Frame("balloonBG_Dark.png", gui.frame_borders, tile=gui.frame_tile)
else:
background Frame("balloonBG.png", gui.frame_borders, tile=gui.frame_tile)
fixed:
if who=="Erkilgul":
text what text_align 0.5 color "#FFF" yalign 0.5 xalign 0.5
else:
text what text_align 0.5 color "#000" yalign 0.5 xalign 0.5
if who=="Semi":
add "gui/talksemi.png" pos(-25,-25)
elif who=="Anzu":
add "gui/talkanzu.png" pos(-25,-25)
elif who=="MB":
add "gui/talkMB.png" pos(-25,-25)
if t=='a':
if who=="Erkilgul":
if a<10:
add "tail_Adark.png" pos (15, 80) zoom 0.7
elif a<25:
add "tail_Adark.png" pos (20, 75) zoom 0.8
elif a<45:
add "tail_Adark.png" pos (50, 95) zoom 0.8
elif a<110:
add "tail_Adark.png" pos (60, 140) zoom 0.9
else:
add "tail_Adark.png" pos (75, 160) zoom 1
else:
if a<10:
add "tail_A.png" pos (15, 80) zoom 0.7
elif a<25:
add "tail_A.png" pos (20, 75) zoom 0.8
elif a<45:
add "tail_A.png" pos (50, 95) zoom 0.8
elif a<110:
add "tail_A.png" pos (60, 140) zoom 0.9
else:
add "tail_A.png" pos (75, 160) zoom 1
elif t=='b':
if a<10:
add "tail_B.png" pos (50, 80) zoom 0.7
elif a<25:
add "tail_B.png" pos (60, 75) zoom 0.8
elif a<45:
add "tail_B.png" pos (100, 95) zoom 0.8
elif a<110:
add "tail_B.png" pos (120, 140) zoom 0.9
else:
add "tail_B.png" pos (150, 160) zoom 1
elif t=='c':
if a<10:
add "tail_C.png" pos (15, -45) zoom 0.7
elif a<25:
add "tail_C.png" pos (20, -55) zoom 0.8
elif a<45:
add "tail_C.png" pos (50, -57) zoom 0.8
elif a<110:
add "tail_C.png" pos (60, -65) zoom 0.9
else:
add "tail_C.png" pos (75, -65) zoom 1
elif t=='d':
if a<10:
add "tail_D.png" pos (50, -45) zoom 0.7
elif a<25:
add "tail_D.png" pos (60, -55) zoom 0.8
elif a<45:
add "tail_D.png" pos (100, -55) zoom 0.8
elif a<110:
add "tail_D.png" pos (120, -62) zoom 0.9
else:
add "tail_D.png" pos (150, -68) zoom 1
elif t=='e':
if a<10:
add "tail_E.png" pos (-47, 20) zoom 0.7
elif a<25:
add "tail_E.png" pos (-57, 20) zoom 0.8
elif a<45:
add "tail_E.png" pos (-55, 30) zoom 0.8
elif a<110:
add "tail_E.png" pos (-65, 50) zoom 0.9
else:
add "tail_E.png" pos (-65, 60) zoom 1
elif t=='f':
if a<10:
add "tail_F.png" pos (97, 20) zoom 0.7
elif a<25:
add "tail_F.png" pos (117, 20) zoom 0.8
elif a<45:
add "tail_F.png" pos (185, 30) zoom 0.8
elif a<110:
add "tail_F.png" pos (230, 50) zoom 0.9
else:
add "tail_F.png" pos (297, 60) zoom 1
This is the callable label
Code: Select all
label talk(who, what, x, y, t):
$ renpy.pause(delay=0.3, hard=True)
$ narrator.add_history(kind="adv", who=who, what=what)
$ a=len(what)
$ tid = a/10 + 0.5
if tid<3.5:
$ tid=3.5
show screen balloon(what, x, y, a, t, who)
if diaForw==0:
pause tid
else:
pause
hide screen balloon
return
Code: Select all
call talk("Semi", _("Hello world!"), 180, 100, 'b')
A weakness with the script is that it is hardwired to a font of a certain size.
Who is online
Users browsing this forum: Google Feedfetcher