Dialogues: animate text

This commit is contained in:
Alice Gaudon 2020-08-16 10:41:14 +02:00
parent 6f4c375465
commit d7c98374ba
5 changed files with 20 additions and 6 deletions

View File

@ -34,6 +34,8 @@ _global_script_class_icons={
config/name="Crabs Game"
run/main_scene="res://scenes/startup.tscn"
boot_splash/image="res://images/titleCrab.png"
boot_splash/use_filter=false
config/icon="res://icon.png"
[display]

View File

@ -10,13 +10,12 @@
[node name="Campfire (background)" type="AnimatedSprite" parent="."]
frames = ExtResource( 1 )
frame = 18
playing = true
centered = false
[node name="Ely" type="AnimatedSprite" parent="."]
frames = ExtResource( 2 )
frame = 97
frame = 63
playing = true
centered = false

View File

@ -24,7 +24,7 @@ script = ExtResource( 1 )
[node name="Fire" type="AnimatedSprite" parent="."]
frames = ExtResource( 6 )
animation = "start"
frame = 41
frame = 5
playing = true
centered = false
script = ExtResource( 1 )

View File

@ -27,7 +27,10 @@ func start(dialogue : Array):
func _input(event):
if event.is_action_pressed("ui_accept"):
next()
if text.visible_characters < text.text.length():
text.visible_characters = text.text.length()
else:
next()
func next() -> void:
_index += 1
@ -38,6 +41,17 @@ func next() -> void:
_update()
func _update() -> void:
text.text = _dialogue[_index].text
title.text = _dialogue[_index].name
text.text = _dialogue[_index].text
#expression = _dialogue[_index].expression
animate_text()
func animate_text():
var animated = _index
text.visible_characters = 0
while animated == _index && text.visible_characters < text.text.length():
if text.text[text.visible_characters] == ' ':
text.visible_characters += 1
text.visible_characters += 1
yield(get_tree().create_timer(0.05), 'timeout')

View File

@ -25,7 +25,6 @@ func start_dialogue(dialog_path : String) -> DialogueAction:
dialogue.start()
return dialogue
var crab_finished = false
var crab_step = 0
func do_crab_step():