TUBES NOW SHOOT UP, A BASKED NOW CATCHES YOU
This commit is contained in:
@@ -3,32 +3,30 @@ class_name Portal
|
||||
|
||||
var level_info = {}
|
||||
|
||||
|
||||
var timer_active = false
|
||||
var active = true
|
||||
var entered = false
|
||||
var index : int
|
||||
|
||||
@onready var timer: Timer = $Timer
|
||||
@onready var scene_holder: Node3D = $Scene_Holder
|
||||
|
||||
const SCENE_SPAWN_OFFSET = Vector3(0,400,0)
|
||||
|
||||
# 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:
|
||||
if body is Player:
|
||||
if active and !entered:
|
||||
active = false
|
||||
timer.start(1)
|
||||
var scene = load(level_info["level_path"]).instantiate()
|
||||
|
||||
get_tree().current_scene.add_child(scene)
|
||||
scene_holder.add_child(scene)
|
||||
scene.global_position = global_position + SCENE_SPAWN_OFFSET
|
||||
|
||||
entered = true
|
||||
if active and entered:
|
||||
var spawned_stuff = scene_holder.get_children()
|
||||
for i in spawned_stuff:
|
||||
i.queue_free()
|
||||
|
||||
|
||||
func _on_start_activation_timeout() -> void:
|
||||
timer_active = true
|
||||
active = true
|
||||
|
||||
Reference in New Issue
Block a user