0 votes

hi i have the body_entered signal to the emitting node itself , here's the code

func _on_Area2D_kts_body_entered(body):
    if body.get_parent().get_parent().get_name() != "map" :

even though the grandparent node name is map , it still execute the condition block
any help would be great

in Engine by (41 points)

1 Answer

0 votes

While I don' t necessarily see the problem, your code doesn't seem to be the most useful way of trying to find it. I wonder if your name has one or more trailing spaces? Does something like this help track it down?

func _on_Area2D_kts_body_entered(body):
    var name = body.get_parent().get_parent().get_name()
    print(">" + name + "<")
    if name != "map":
        print("name is not map")
by (14,956 points)

not it but thx

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.