0 votes

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

in Projects by (21 points)

Please log in or register to answer this question.

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.

Categories