class_name MaskProjectile extends MaskAbility

@export var speed := 500.
@export var spawn_sfx : AudioStream

var dir : Vector2 = Vector2.RIGHT
var rot_speed = 30

func mask_ready():
	super.mask_ready()
	dir = to_local(target_position).normalized()
	SoundManager.play_sfx(spawn_sfx)
	get_tree().create_timer(20).timeout.connect(queue_free)
	create_tween().tween_property(self, "rot_speed", 3, 0.3)

func _physics_process(delta: float) -> void:
	rotation += rot_speed * delta
	position += dir * speed * delta

func _on_hitbox_collided() -> void:
	queue_free()
