game: add spawn rate to debug ui

This commit is contained in:
2025-08-20 19:41:13 +02:00
parent 7136b07de5
commit 56278de1d7
6 changed files with 34 additions and 4 deletions

View File

@@ -11,9 +11,10 @@ const ENEMY_RAT = preload("res://scenes/enemies/enemy_rat.tscn")
func _ready() -> void:
timer.wait_time = spawn_rate / 1
timer.wait_time = 1 / spawn_rate
timer.start()
GlobalConst.sig_stop_spawning.connect(_on_stop_spawning)
GlobalConst.sig_set_spawn_rate.connect(_on_set_spawn_rate)
func _on_timer_timeout() -> void:
@@ -25,9 +26,11 @@ func _on_timer_timeout() -> void:
new_enemy.target = target
add_child(new_enemy)
func _on_stop_spawning(val: bool):
if val:
timer.stop()
elif timer.is_stopped():
timer.start()
func _on_set_spawn_rate(val: float):
timer.wait_time = 1 / val