diff options
-rw-r--r-- | components/textreveal.gd | 7 | ||||
-rw-r--r-- | components/textrevealbox.tscn | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/components/textreveal.gd b/components/textreveal.gd index 9b5bfaa..9a05e62 100644 --- a/components/textreveal.gd +++ b/components/textreveal.gd @@ -29,12 +29,19 @@ func _process(delta): if not started: return t += delta * speed + if t < 0: + return var additional = int(t) t -= additional revealed += additional if additional >= 1: BackgroundMusic.type_sound() text = to_render.substr(0, revealed) + if additional > 0: + if text.ends_with("\n"): + t = -10 + elif text.ends_with(" "): + t = -2 rect_position = -rect_size / 2 + Vector2(xpos, ypos) if to_render.length() <= revealed: started = false diff --git a/components/textrevealbox.tscn b/components/textrevealbox.tscn index 79c1cee..aa22aa7 100644 --- a/components/textrevealbox.tscn +++ b/components/textrevealbox.tscn @@ -15,4 +15,5 @@ script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false } + [connection signal="finished_reveal" from="TextReveal" to="." method="_on_TextReveal_finished_reveal"] |