Thank you for answering :) But I still can't seem to get it to work quite right. I either get an error ( previous node freed) or my player keeps spawning in the middle of the map when leaving the house instead of spawning in front of the door like he should. Maybe I'm missing something obvious or maybe a little more information is needed ¯_(ツ)_/¯
my player is already in both scenes, so there's no need to instance him over though I know how to do it both ways. I'm using an area 2D for tile base movement so there's no kinematic body to use. Here's some code :)
my door code:
export(String, FILE, "*.tscn") var world_exit
var areas = get_overlapping_areas()
for area in areas:
if area.name == "Player" && Input.is_action_just_pressed("ui_accept"):
func _on_Door_area_entered(_area: Area2D) -> void:
# Store value
I'm thinking I can store/give a value once the player overlaps with the door area. And I can use that variable to set a new spawn location. Just have no idea how to do that.
code attached to the main level node:
$Player.global_position = $Player_spawner.global_position
the Player spawner will be a position 2D so I can set them freely throughout the world and not have to worry about a door or whatever being put in the middle of a forest. Woulds just seem out of place.
I also have a singleton as well, just have no idea what to do with it.
code is literally just var playerpos = null
maybe I can use this to store the values I need but I'm not really sure.
If you have any other ways to make this work I'm all ears :) I'll just fiddle around with your code and mines until it works like I want it to. Hope what I've posted isn't to confusing. Thank you again :)