Waves and menu update

This commit is contained in:
2025-08-26 11:11:50 +02:00
parent 6c1a3d54bd
commit bc6e06237c
4 changed files with 49 additions and 6 deletions

View File

@ -23,10 +23,19 @@ var waves = [
[50, 0.9, 0.1, 0.2, 0.7], #wave 5
]
var currentwave = 0
var endwave = false
func _on_timer_timeout() -> void:
spawnMonster()
if endwave:
if not get_node("Path2D").get_children():
endwave = false
get_node("CanvasLayer/SidePanel").Update_waves(currentwave + 1) #updating waves
else:
spawnMonster()
func spawnMonster():
currentwave = 0
for w in waves:
if w[0] > 0:
if randf() < w[1]: #chance of generating any kind of enemy
@ -42,6 +51,9 @@ func spawnMonster():
path_2d.add_child(path)
break
break
else:
currentwave += 1
endwave = true
func decrease_life(damage) -> void:
get_node("CanvasLayer/SidePanel").Update_Lifes(-damage)