Multiple Area2Ds. How to detect if part of group?

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

See title. There will be a LOT of ladders in my game, all of them using the same Area2D to determine if the player is overlapping the ladder or not. However, when I try to instance multiples of the same object, I run into errors.

So, what I’m wanting to do is send the enter body signal when the player is overlapping ANY of the Area2Ds in the ladder group, instead of making a whole new object for each ladder tile. How would I accomplish this?

It’s not clear what you’re doing. You said “using the same Area2D” but also “instance multiples of the same object”. Which is it? What errors do you see?

Provide some more information about your situation and it will be easier to give you some advice.

kidscancode | 2018-10-22 01:19

When I was working on my game, I used an Area2D node to determine if the player is on a ladder. Code worked perfectly, UNTIL I attempted to duplicate the object. They would still work, provided I made every ladder in my game the same height. But if I tried to adjust the size of one of those duplicates, the others would resize as well. So, what I’m wanting to do is have a ladder group that toggles a flag if the player is overlapping one. Allowing me to resize as needed.

9BitStrider | 2018-10-23 20:09

:bust_in_silhouette: Reply From: kidscancode

When you duplicate an Area2D (or any other CollisionObject2D), the shape resource is shared among them. That’s why resizing one will resize all of them. You can prevent this by choosing “Make Unique” on the CollisionShape2D in the Inspector.