Random Spawn path following player movement

A node’s position is relative to the position of its parent. If you want the absolute position, that is, relative to the origin at (0,0), use global_position instead!

That being said, your solution seems needlessly complex to me, when you could just as well do it like this:

func _on_test_timer_timeout():
    var child = player_scene.instantiate()
    child.global_position.x = $CharacterBody2D.global_position + randf_range(100, 100)
    add_child(child)
2 Likes