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,8 +31,14 @@ var coins = 0
func _ready() -> void:
get_node("pausemenu").hide()
get_node("pausemenu").z_index = 5
get_node("GameOver").hide()
get_node("GameOver").z_index = 5
get_node("GameWon").hide()
get_node("GameWon").z_index = 5
get_node("Panel").show()
get_node("Panel").z_index = 5
get_node("WaveCounter").show()
get_node("WaveCounter").z_index = 5
stickspawner.connect("button_up", Spawn_Stick)
stickspawner.tooltip_text = "Cost: 10\nReturn: 5"
@ -57,6 +63,8 @@ func _ready() -> void:
func _process(delta : float)-> void:
coinlabel.text = "Coins: " + str(coins)
livelabel.text = "Lives: " + str(lives)
if lives <= 0:
GameOver()
func set_Lifes(amount) -> void:
lives = amount
@ -139,6 +147,22 @@ func _unhandled_input(event):
get_parent().get_parent().get_node("Timer").stop()
func GameOver() -> void:
get_node("Panel").hide()
get_node("GameOver").show()
for i in get_node("../../Path2D").get_children():
i.get_children()[0].set_process(false)
for i in get_parent().get_children():
if i.name != "sidepanel":
i.set_process(false)
var timer_node = i.get_node("Timer") if i.has_node("Timer") else null
if timer_node:
timer_node.stop()
func GameWon() -> void:
get_node("Panel").hide()
get_node("GameWon").show()
func _on_button_3_pressed() -> void:
get_node("pausemenu").hide()