This would be a bit more complex, you would need a global script and when you go from scene 1 to scene 2 you would need to save the global position of the character into a variable in that script. You would also need code in scene 1 to check if you need to load the character into a new position so probably a boolean in the global script again which would also have been set to true when you saved the global position.
I dont know of any videos and its hard to write this much code in here but hopefully the above will give you some ideas.
If you need to know how to create a global script you can go project>project settings>autoload and in here you can set a script to autoload. This will mean that any script set to autoload will load up in every scene.
IMHO get_tree().change_scene() is a very horrible function and change_scene_to is not any better because they both use PackedScene’s and not instances.
It’s for this reason you should managed scene changes yourself
In your main scene keep a reference to all scenes
Create a scene change function
Use one of two options to change your scene
Add and Remove Scene nodes
Replace Scene nodes with others
Option 1
var scene_one = load("scene_one").instance()
var scene_two = load("scene_two").instance()
var current_scene = null
func _ready():
switch_scene(scene_one)
func switch_scene(new_scene):
if new_scene.is_inside_tree():
return
#Add new scene below old scene to keep
#the same index once old_scene is removed
if current_scene and current_scene.is_inside_tree():
add_child_below_node(new_scene, current_scene)
remove_child(current_scene)
else:
add_child(new_scene)
current_scene = new_scene
Option 2
func switch_scene(new_scene):
if new_scene.is_inside_tree():
return
if current_scene and current_scene.is_inside_tree():
current_scene.replace_by(new_scene)
else:
add_child(new_scene)
current_scene = new_scene
In the above examples the scenes are kept in their respective variables as is and can even be manipulated (for example a score change in scene_two can be updated in scene_one)