|Attention||Topic was automatically imported from the old Question2Answer platform.|
I’m making a game where coins spawn, one of the characters of the game walks around the scene and spawn coins, due to some functions, I decided to create like a core coin that is cloned and then changes the position of the cloned coin to the character’s position.
I tried using
duplicate() but didn’t work, I thought it doesn’t duplicate sub-nodes so I decided testing cloning the sprite and changing its position, the console says the position where it was changed, but in-game it doesn’t show in that position.
Basically, the code is like this:
func on_timeout(): var thingy = get_parent().get_node("Group/Coin") var thingyTwo = thingy.duplicate() thingyTwo.position.x = 0 print(thingyTwo.position.x)