How do I make an Area2D react only if entered by specific node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Alena

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?

:bust_in_silhouette: Reply From: rossunger

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)

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
      #do what i want

I don’t know if these are collision layers, but I found this solution when I googled them :slight_smile:

Alena | 2022-02-13 16:55