diff options
author | rom <romangraef@gmail.com> | 2021-04-26 23:30:53 +0200 |
---|---|---|
committer | rom <romangraef@gmail.com> | 2021-04-26 23:30:53 +0200 |
commit | a266b75bde735a02ead93e90592dbb1d78d2474d (patch) | |
tree | fd1bfb812f2753b1de689da9f4db75e3eb198185 | |
parent | d7cf9a6b347ab2b0366cfab1a9fb8cbd6fb3a21a (diff) | |
download | ldjam48-a266b75bde735a02ead93e90592dbb1d78d2474d.tar.gz ldjam48-a266b75bde735a02ead93e90592dbb1d78d2474d.tar.bz2 ldjam48-a266b75bde735a02ead93e90592dbb1d78d2474d.zip |
timers on textrevealbox
-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"] |