extends Node2D class_name Teleport @export_node_path("Teleport") var target: NodePath var targetNode: Teleport # Called when the node enters the scene tree for the first time. func _ready(): self.targetNode = get_node(self.target) self.targetNode.get_node("Leave").connect("body_exited", _on_body_exited) func _on_body_entered(body): if body is Player: var player: Player = body (func(): self.targetNode.get_node("Enter/CollisionShape2D").disabled = true).call_deferred() player.position = self.targetNode.position func _on_body_exited(body): if body is Player: (func(): targetNode.get_node("Enter/CollisionShape2D").disabled = false).call_deferred()