This repository has been archived on 2023-08-08. You can view files and clone it, but cannot push or open issues/pull-requests.
evospace/levels/level.gd

20 lines
387 B
GDScript

extends Node
export (Array, PackedScene) var waves
var rng = RandomNumberGenerator.new()
var passed_waves = 0
var wave
var level
func _ready():
level = get_tree().get_root().get_node("level")
rng.randomize()
next_wave()
func next_wave():
wave = waves[rng.randi_range(0, waves.size() - 1)].instance()
wave.level = self
level.call_deferred("add_child", wave)
passed_waves += 1