Hi Anderoo99
I found the easiest way is add an Area2D added to one or of the objects. On the object use the signal _on_Area2D_body_entered
Then in the code on that object
func _on_Area2D_body_entered(body):
if body.is_in_group("enemy"):
print(body.name)
print(body.position)
Make sure you add the name to the node node group.
Not sure if this is what you need? also if you add Area2d's to both object you can use the below on both objects(change the node group on each)
Enemy code
func _on_Area2D_area_entered(area):
if body.is_in_group("player"):
print(area.name)
Player code
func _on_Area2D_area_entered(area):
if body.is_in_group("enemy"):
print(area.name)
Hope this helps.