26 lines
606 B
GDScript
26 lines
606 B
GDScript
class_name ArrowGirl extends Area2D
|
|
|
|
@onready var _sprite = $AnimatedSprite2D
|
|
var dialog_text = preload("res://DialogDebug_1.tres")
|
|
var dialog_counter: int = 0
|
|
|
|
#boilerplate
|
|
func _ready():
|
|
_sprite.play("idle", 1)
|
|
|
|
#animation stuff
|
|
func _on_animation_finished() -> void:
|
|
if randf() < 0.2:
|
|
_sprite.play("idle_glance", 2)
|
|
else:
|
|
_sprite.play("idle", 2)
|
|
|
|
func _on_body_entered(body) -> void:
|
|
if body is BoxBoy:
|
|
%DialogController.set_dialog(dialog_text.get_line_raw(dialog_counter), 0.2)
|
|
dialog_counter += 1
|
|
|
|
func _on_body_exited(body) -> void:
|
|
if body is BoxBoy:
|
|
%DialogController.set_dialog("")
|