0 votes

Hi, i have a node-less script extend area2d and attached it to multiple area2d node in my game, the code is to see if the area colide with a body with difference parent node it will hide the node that the area2d node is attched to

extends Area2D





func _ready():
# warning-ignore:return_value_discarded
    self.connect("body_entered", self, "body_entered")




func body_entered(x):
    var a = x.get_parent().get_parent().get_name()
    if a != "map" :
        x.get_parent().hide()
        print(x.get_parent().get_parent().get_name())

but it doesnt seem to work, putting a break into the code show that a is "map"
but the condition in the signal still run anyway enter image description here
pls help

in Engine by (40 points)

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.

Categories