game: add spawn rate to debug ui
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user