From a266b75bde735a02ead93e90592dbb1d78d2474d Mon Sep 17 00:00:00 2001 From: rom Date: Mon, 26 Apr 2021 23:30:53 +0200 Subject: timers on textrevealbox --- components/textreveal.gd | 7 +++++++ components/textrevealbox.tscn | 1 + 2 files changed, 8 insertions(+) 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"] -- cgit