0 votes

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"
Godot version 3.2.3
in Engine by (12 points)

1 Answer

0 votes

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

objective.set_position(position2D.get_position()) 
by (41 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.