Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | mohammad nanda |
i’m beginner in Godot, and i need to make in and out House feature or something like that
i use this for traveling scene:
extends Node
var current_scene = null
func _ready():
var root = get_tree().get_root()
current_scene = root.get_child(root.get_child_count() - 1)
func goto_scene(path):
call_deferred("_deferred_goto_scene", path)
func _deferred_goto_scene(path):
current_scene.free()
var s = ResourceLoader.load(path)
current_scene = s.instance()
get_tree().get_root().add_child(current_scene)
get_tree().set_current_scene(current_scene)
print(get_tree().get_current_scene())
i add 2 kinematic 2d in 2 different scene, in outside house and inside house scene
but everytime i go to different house in same outside, and exit that house, i will spawn on my current outside kinematic2d location (obviously because I haven’t set up my 2d kinematic to do that, because I can’t yet, I don’t know)
but i cant find an example to set my kinematic to do so, can you lend me a hand? i want to start making a game, a simple game