Topic was automatically imported from the old Question2Answer platform.
Asked By
droc101
func _on_Area2D8_body_entered(body):
if Input.is_action_pressed("opendoor"):
get_tree().change_scene("res://basement.tscn")
this code it triggering instantly upon scene load. I do have code to wait one frame under the _ready function. i want it to trigger only when the player (KinematicBody2D) enters the area2d. The player does not spawn on an area2d.
I can confirm that problem. It seems to be some sort of bug in the engine.
You could try to use
yield(get_tree(), "idle_frame")
before adding the player to the scene.
Or set the initial position of the player to a very far away position, before adding it to the level and then setting it to the proper position, when entering the level.
Guess who helped me big boy! YOU!! 5 hours on this one. Guess its those chumps fault ahahahah Knew it wasnt my code… No no no