Game Won, Game Over and Tower fixes

This commit is contained in:
2025-08-27 15:40:42 +02:00
parent bc6e06237c
commit 77d610eccb
5 changed files with 155 additions and 12 deletions

View File

@ -31,6 +31,8 @@ func _on_timer_timeout() -> void:
if not get_node("Path2D").get_children():
endwave = false
get_node("CanvasLayer/SidePanel").Update_waves(currentwave + 1) #updating waves
if currentwave >= 5:
get_node("CanvasLayer/SidePanel").GameWon()
else:
spawnMonster()
@ -40,6 +42,8 @@ func spawnMonster():
if w[0] > 0:
if randf() < w[1]: #chance of generating any kind of enemy
w[0] -= 1
if w[0] <= 0:
endwave = true
var chosen = randf()
var sum = 0.0
for i in range(2,5):
@ -53,7 +57,7 @@ func spawnMonster():
break
else:
currentwave += 1
endwave = true
func decrease_life(damage) -> void:
get_node("CanvasLayer/SidePanel").Update_Lifes(-damage)