0 votes

Hello I don't know if my other question came out but anyways. I making a survival game with a build system, I want it o work like this: A spatial called "Player builds" when the player build something it will cloned as a child of "Player build" but it uses it's parent's position please help me.

Godot version 3.5
in Engine by (12 points)

1 Answer

0 votes

Cloning can be achieved by duplicate()
but is rarely a good sollution. It is usually better to create and save a scene of a building, and use instance() to create multiple objects of the same kind.
You can always refer to position and set it, like

PlayerBuild.add_child(building)
building.global_position = Vector2(240,123)
by (8,101 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 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.