extends Node2D signal shot const INVADER = preload("res://scenes/invader.tscn") var can_spawn = false func _process(_delta: float) -> void: if can_spawn: spawn_invader() $SpawnTimer.wait_time = randi_range(20, 40) func _on_spawn_timer_timeout() -> void: can_spawn = true func spawn_invader() -> void: var invader := INVADER.instantiate() invader.shot.connect(player_shot) $Invaders.add_child(invader) can_spawn = false $SpawnTimer.start() func player_shot() -> void: shot.emit()