Files
fps_project_1/scripts/scene_changer.gd
2025-03-28 14:30:27 -05:00

33 lines
708 B
GDScript

extends Area3D
class_name Portal
var level_info = {}
var timer_active = false
var active = true
var index : int
# 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: Node3D) -> void:
if body.is_in_group("player"):
if active and timer_active:
active = false
var scene = load(level_info["level_path"]).instantiate()
get_tree().current_scene.add_child(scene)
scene.global_position = global_position
func _on_start_activation_timeout() -> void:
timer_active = true