0 votes

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?

in Engine by (197 points)

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.

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.

1 Answer

+1 vote

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.

by (20,479 points)
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.