I'm working on a project follow a tutorial.
I'm trying to use Timer to set the time when a preloaded scene comes up on stage. It's a scene consisting of 8 other instanced scenes (I've already preloaded it in the stage scenes). When the scene comes up, the game window freeze for a moment which is hard to notice. But if I instance a bunch of scenes like that, the freezing will be obvious.
Thanks in advance.
Stage scene's scripts:
extends Node2D
var f_as1 = preload("res://elements/formations/f_alpha_straight_toptobot_ch1.tscn")
var aship = preload("res://elements/elements/e_enemy_alpha.tscn")
func _ready():
$Timer.start()
_process(true)
pass
func _process(delta):
yield($Timer, "timeout")
var a = f_as1.instance()
get_node("/root").add_child(a)
pass