I am using a tutorial, and made a portal. However my I want a portal back to my original level while restarting it.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Parsa

I tried following some tutorial but either my game crashed or it did not work. I have linked the code below and if anyone has an idea that would be great.
Code:
tool
extends Area2D

onready var anim_player: AnimationPlayer = $AnimationPlayer

export var next_scene: PackedScene

func _on_body_entered(body):
teleport()

func _get_configuration_warning() → String:
return “The next scene property can’t be empty” if not next_scene else “”

func teleport() → void:
anim_player.play(“fade_in”)
yield(anim_player, “animation_finished”)
get_tree().change_scene_to(next_scene)

export var next_scene: PackedScene
I don’t know if there is a difference but…
try
export(PackedScene) var next_scene

ramazan | 2022-08-06 08:42