How do I change the position of an object to the position of another?

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

I’ve been trying to make an objective system where you go over a marker and it changes the objective. I want to have a marker that moves to a Position2D node, then when you touch that it goes to a different Position2D. But I’m very stuck. I’ll give you the code so you can hopefully help me out.

extends StaticBody2D

func _process(delta):

if Vars.objective == 1:
	add_child_below_node($"/root/Pos", $"/root/Marker")
	$Objective.text = "Go to marker"

if Vars.objective == 2:
	$Objective.text = "do it again"

if Vars.objective == 3:
	$Objective.text = "you know what to do"
:bust_in_silhouette: Reply From: RafaelGomes

You can have a reference to all your position 2D nodes, and just do:

objective.set_position(position2D.get_position())