I have circular RigidBody2D objects in separate nodes. Think of them as pool balls.
When two of these objects collide I want to destroy only one.
I've tried this
func _on_RigidBody2D_body_entered(body):
var nameOfCollider = body.get_parent().get_name()
if (nameOfCollider.substr(0,4) == "ball"):
print ("hit " + nameOfCollider)
queue_free()
var rigidBody = get_node("RigidBody2D")
rigidBody.set_physics_process(false)
rigidBody.set_process(false)
in the root of the node.
But this destroys both of them.
What can I do to make only one be destroyed?
Thanks in advance.