In my game I have to have an area 2d connected to the main characterbody 2d so I can detect damage and that area2d has to have its own script because I cant put the get_overlapping_areas function in a characterbody. I was wondering how I would take a variable from my characterbody script and put it in the area2d script so that I can change a variable in the area2d script. How would I do this?
`extends Area2D
var areas = []
func _process(delta: float) -> void:
areas = get_overlapping_areas()
for area in areas:
if area.is_in_group("Good"):
print("Area is working")
elif area.is_in_group("Hurt"):
print("damage")`