hello! I'm trying to make my character appear in the left of the room when it's coming from outside, and in the right of the room when it's coming from another room. I can travel between scenes(outside-room1,room1-room2 and viceversa) with Area2Ds. I only have one script for all the Area2Ds, so when i travel from room1 to room2 the code looks like this:
if get_tree().get_current_scene().get_name() == "home-floor1-livingroom":
if right==true:
get_tree().change_scene("res://scenes/home-floor1-kitchen.tscn")
print("yes1")
emit_signal("left")
here the yes is printed...I want to set the character's position in code, but it doesn't work. The character remains where I put it with my mouse,the code doesn't change anything. The receiving code look like this:
func _ready():
print("yes2")
var teleportation=get_node("Area2Dkitchen1")
teleportation.connect("left",self,"teleport_left")
func _on_Area2Dkitchen1_left():
print("yes")
$Player.position.x=100
func teleport_left():
print("yes")
$Player.position.x=100
I tried to connect it manually(onArea2Dkitchen1left()) and from the code(teleportleft()), it doesn't even print "yes". What am I doing wrong? the area2d and the room is in the same scene and i connected them correctly. Any advice? I am still a begginer, so any help is useful and well received.