Dialogues: animate text
This commit is contained in:
parent
6f4c375465
commit
d7c98374ba
@ -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]
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 )
|
||||
|
@ -27,6 +27,9 @@ func start(dialogue : Array):
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("ui_accept"):
|
||||
if text.visible_characters < text.text.length():
|
||||
text.visible_characters = text.text.length()
|
||||
else:
|
||||
next()
|
||||
|
||||
func next() -> void:
|
||||
@ -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')
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user