Hello there
I'm currently making a small game, and I'd like to add dialog sounds when a character is talking, like shown in this video [
The big problem... I'm using a Dialog tool in Godot which is currently handled by a Tween setting the "percent_visible" of a RichTextLabel from 0 to 1. That has a bid downside! The text is being written in 1 second or so, meaning long text gets written really fast, and slow text really slow.
I tried to smooth it out abit by declaring a new variable called "duration" with is 1. Its then checking how long the total number of characters there are in a sentence. Depending on the number of characters, the value drops or increases.
Like this:
<pre class="prettyprint">
var duration = 1
if _Body_Label.bbcode_text.length() <= 5:
duration = 0.25
elif _Body_Label.bbcode_text.length() <= 15:
duration = 0.5
elif _Body_Label.bbcode_text.length() <= 30:
duration = 0.75
elif _Body_Label.bbcode_text.length() <= 50:
duration = 1
elif _Body_Label.bbcode_text.length() <= 100:
duration = 1.5
$Tween.interpolate_property(
Body_Label, "percent_visible", 0, 1, duration,
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT
)
$Tween.start()
</pre>
This is a lazy solution for the problem, but it throws in more problems. For example handeling the timing of the dialog sound.
I also looked into using a timer instead of a tween, but it didn't really work as intended, and since I'm not the best programer I afraid, I'm not able to fix it on my own ._.
If you happen to know what I could do, then I would be hella thankful!! Since I really do not know how to solve this...
Thank you in advance!
P.S. Ignore the < pre class="prettyprint"> its just to format the code correctly in this thread