extends CharacterBody2D signal hit @export var target: Vector2 var direction: Vector2 @export var speed: int = 50 func _ready(): velocity = position.direction_to(target) * speed func _physics_process(delta): $AnimatedSprite2D.play("default") move_and_slide() func _on_area_2d_body_entered(body): if body is Player: hit.emit() queue_free() func _on_visible_on_screen_notifier_2d_screen_exited(): queue_free()