0 votes

Hi,
I am trying to make a panel with sprite disappear if it enters an Area2D but it is disappearing also when other panels enter this area.
I cannot make a simple function where the wanted panel with sprite would disappear every time its area is entered, because then, it would disappear also when the other panels collide with it.

Is there a way to specify which Areas should mutually react only to each other and not the others?

Godot version v3.3.3
in Engine by (18 points)

1 Answer

0 votes

You can use collision layers.

Or you can check who the parent of the Area2D is or something like
(if get_parent().name == "player": or whatever)

by (1,342 points)

Thank You soooo much.
I used collision layers (at least I think that's what it is) and it worked.

I simply wrote:

 func _on_Area2D_entered(area):
   if "name-of-area-i-want-the-other-area-to-react-to" in area.name:
      #do what i want

I don't know if these are collision layers, but I found this solution when I googled them :)
`

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.