better spawn, heart ui, dash, new map
This commit is contained in:
parent
ce27965422
commit
34be761164
16 changed files with 137 additions and 171 deletions
23
scripts/wave_node.gd
Normal file
23
scripts/wave_node.gd
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
class_name WaveNode extends Node2D
|
||||
|
||||
@export var spawn_interval := 0.2
|
||||
signal finished;
|
||||
var entities := 0;
|
||||
|
||||
func _ready() -> void:
|
||||
entities = get_child_count()
|
||||
|
||||
func spawn_wave():
|
||||
if get_child_count() == 0:
|
||||
finished.emit()
|
||||
return;
|
||||
|
||||
for c : Spawner in get_children():
|
||||
c.spawn();
|
||||
c.finished.connect(entity_left)
|
||||
await get_tree().create_timer(spawn_interval).timeout
|
||||
|
||||
func entity_left():
|
||||
entities -= 1
|
||||
if entities <= 0:
|
||||
finished.emit()
|
||||
Loading…
Add table
Add a link
Reference in a new issue