diff options
Diffstat (limited to 'lib/ticked.gd')
-rw-r--r-- | lib/ticked.gd | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ticked.gd b/lib/ticked.gd index cef46ab..cacfaef 100644 --- a/lib/ticked.gd +++ b/lib/ticked.gd @@ -1,4 +1,4 @@ -extends Node +extends Node2D class_name Ticked export var tick_rate := 1.0 @@ -8,6 +8,9 @@ func _tick(): func _process(delta: float) -> void: current_tick += delta + if tick_rate < 0: + current_tick = 0 + return while current_tick > tick_rate: _tick() current_tick -= tick_rate |