0 votes

Hey, I'm new to Godot (1-2 months) and I'm trying to do a dynamic dialog system.
To clarify, I want the text to appear one char at a time, with was easily implemented using the visible_character property of the rich text label node (following heartbeast tutorial on dialog). the thing is that I want the dialog box to appear on top of the player talking(done) and I wanted it to slowly grow horizontally as the text appears and vertically when a certain threshold is met horizontally.

I'm struggling on that last part. since my font is not monospace and I use BBCode (some of the text will not appear but still exist in the string) it is hard to get a consistent solution.

So the question is, what the best approach to this. here some photo/video of what's happening and my tree.

the tree: https://imgur.com/a/iuyYFhk
the behaviour: https://imgur.com/a/ufaHBt6

onready var textlabel = $RichTextLabel
onready var panel = get
onready var timer = $Timer
var text = ["Hey, this is a [wave]dialog box[/wave] . I know, it's pretty [color=blue]cool[/color] right?","i hope it is working [rainbow]fine[/rainbow].","it's nice outside isn't it?"]
var page = 0 func reset():
left = 2
marginright = 2
top = -20
marginbottom = -10
top = -22
panel.marginbottom = -8
right = 1
panel.margin_left = -1 func onTimertimeout():
if text
label.getvisiblecharacters() < text[page].length():
if textlabel.getvisiblecharacters() <= 30:
left -=1
marginright += 1
left -= 1
panel.marginright += 1
if text
label.getvisiblecharacters() % 40 == 0 and text[page].length() - textlabel.getvisiblecharacters() > 40 :
top -= 10
panel.margin_top -= 10
if page == text.size()-1:
page = 0
panel.visible = false
visible = false
page += 1

So I didn't do a lot of UI in Godot so far (obviously) and what I do is that I change the margin of my rich text label and panel each time a new char is added(or each time my timer timeout).

Godot version 3.3
in Engine by (18 points)

1 Answer

0 votes

Hi, I'm also new to Godot. I am also interested in this question

by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.