Escoria: How do I change a scene to another scene.?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ExiledBeast
:warning: Old Version Published before Godot 3 was released.

Example: “Player is in the current scene, and when the player move to the edge, he’s in another scene”.

:bust_in_silhouette: Reply From: Gokudomatic2

This is in the documentation: http://docs.godotengine.org/en/stable/tutorials/step_by_step/singletons_autoload.html

thanks for the help.

ExiledBeast | 2016-10-17 14:26

:bust_in_silhouette: Reply From: Matthew Valancy

With Escoria you can do something like this… I made a level exit scene with a cool arrow marker that has animations etc. When the player walks too far to the left of that marker I make a call to vm.run_event()

vm.run_event basically lets you run things the same way as using a .esc file, it just has a tricky “event” format.

So at the top of my scene script for the level_exit I have:

export(String, FILE, “*.scn”) var scene_file

then in your function call wherever you trigger the scene change do:

var vm = get_tree().get_root().get_node(“vm”)
event = [{“name”:“change_scene”, “params”:[scene_file]}]
vm.run_event(event)

That triggers a scene change just like in a .esc file for an object I think but without requiring the player to use the object etc. I just trigger it by proximity instead.