extends Node2D

@export var damage = 8
@export var knockback_strength = 2

func _on_area_entered(area: Area2D) -> void:
    if self.get_parent().is_in_group("Virus"):
        # Prevent friendly fire
        return
    var area_parent = area.get_parent()
    if (area_parent.is_in_group("Virus")):
        area_parent.take_hit(damage, self.position.direction_to(area.position) * 100, knockback_strength)

func _on_body_entered(body):
    if self.get_parent() == body:
        return
    body.take_hit(damage, self.position.direction_to(body.position) * 100, knockback_strength)