extends BaseProjectile
class_name WoodenArrow

@onready var animation_player: AnimationPlayer = $AnimationPlayer

var _despawn_queued := false

# Private Methods
func _ready() -> void:
	speed = 8000


func _on_collision_detector_area_entered(_area: Area2D) -> void:
	queue_despawn()


func _on_collision_detector_body_entered(body: Node2D) -> void:
	if body == self: return
	queue_despawn()


func queue_despawn() -> void:
	if _despawn_queued: return
	_despawn_queued = true
	
	animation_player.play("shaking")
	await animation_player.animation_finished
	
	queue_free()
