On_body_entered not working with already existing rooms

Godot Version

Godot 4

Question

I’ll try to not be too confusing. I have a room with 4 walls on their own tilemaps. Each wall has a “detector” outside of it so when you build a room beside it, it will “queue_free()” the wall it’s connected to.

Before running the game if i place rooms down the walls work perfectly and will get rid of the walls so that the rooms connect.

However, when i run the game as the player and i place a new room down, the wall of the room i am placing will go away like its supposed to, but the wall of the old room will not be deleted.

If i place my character outside the walls and run him through the “detectors” they will disappear as intended but for some reason the old rooms are not detecting the new rooms and as a result their walls stay up. (i have also tested with the print function that it is those walls that are being deleted)

been struggling for a week please help!!! lol

Hi, here are my thoughts on what’s going on:

  1. It’s not entirely clear which “body” should enter or leave Area2D. Probably it’s a “new room”, then it’s better to specify the condition that if a “wall” or “room” enters Area2D, but delete the wall.
  2. The next possible moment for bugs is a connected signal. That is, the signal is connected and triggered a deletion. The wall was deleted, the signal remains connected. To exclude this option, it is necessary to disconnect the signal when the wall disappears and connect when it enters.
  3. And finally, about CollisionShape - the Shape parameter is a RESOURCE. Accordingly, it behaves as a single whole in all its instances. Check in your “original scene” (room) on all Collisions, if the “Local to scene” box is checked. Perhaps it deletes the wall scene together with the CollisionShape, since all copies of the resource are linked.