Files
godot-action-adventure-test/Scenes/SceneEntrance/scene_entrance.gd
T

25 lines
671 B
GDScript

extends Area2D
@export var next_scene: String
@export var player_spawn_pos: Vector2
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_body_entered(body: Player) -> void:
print("body entered!")
$"/root/SceneManager".player_next_scene_spawn_pos = player_spawn_pos
get_tree().change_scene_to_file.call_deferred(next_scene)
pass # Replace with function body.
func _on_body_exited(body: Node2D) -> void:
print("player left!")
pass # Replace with function body.