Set node position from node 2d

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

Hi. I’m trying to set the position from the node 2d script for a
Child sprite.
How can I set the position to a child sprite from the parent script.
Getting the position works…
get_node(“player”). position

But how can I set the position lets say to (100,50) coordinates,?

:bust_in_silhouette: Reply From: ejricketts

So we can define the position you want to move to, and then use the handy function set_position() to move your node, i.e.,

var position_vector = Vector2(100,50)

This will move the “player” node and its children to the desired vector.