32 lines
648 B
GDScript
32 lines
648 B
GDScript
extends ReferenceRect
|
|
|
|
export var speed : float = 0.05
|
|
export var flip_h : bool
|
|
export var pitch : float = 1
|
|
|
|
signal animation_ready
|
|
|
|
func _ready():
|
|
modulate.a = 0
|
|
if flip_h:
|
|
$Arrow.flip_h = true
|
|
$Arrow.set_position(Vector2(0, rect_size.y))
|
|
$TypeSound.pitch_scale = pitch
|
|
|
|
func say(text : String):
|
|
$Label.visible_characters = 0
|
|
$Label.text = text
|
|
|
|
if modulate.a != 1:
|
|
$Animation.play("fade")
|
|
|
|
for i in text.length() + 1:
|
|
$Label.visible_characters = i
|
|
$TypeSound.play()
|
|
yield(get_tree().create_timer(speed), "timeout")
|
|
|
|
emit_signal("animation_ready")
|
|
|
|
func fade_out():
|
|
if modulate.a != 0:
|
|
$Animation.play_backwards("fade")
|