extends SharedSlime class_name Cultist var victim func _process(delta): super._process(delta) if task == "corrupt": corrupt() func corrupt(): # Make sure the victim is still next to the cultist. if location_xz.distance_to(victim.location_xy) <= 1 and victim != null: rotate_y(deg_to_rad(15)) if victim.hp <= 0: $evilslime.play() task = "idle" else: task = "idle" # For corruption detection range. func _on_target_radius_body_entered(body): if body.is_class("Villager"): victim = body walk_speed = 2 * walk_speed target_location_xz = victim.location_xz task = "walk" # For collision with other slimes. func _on_collision_detection_body_entered(body): if body.is_class("Villager"): task = "corrupt"