ticker
This commit is contained in:
parent
c5846aba7b
commit
074bb21ffd
18 changed files with 99 additions and 51 deletions
16
scripts/autoloads/ticker.gd
Normal file
16
scripts/autoloads/ticker.gd
Normal file
|
@ -0,0 +1,16 @@
|
|||
extends Timer
|
||||
|
||||
const tics_per_second :float = 32.0
|
||||
signal tick(current_tick: int)
|
||||
|
||||
var current_tick: int
|
||||
|
||||
func _ready() -> void:
|
||||
start(1.0/tics_per_second)
|
||||
timeout.connect(make_tick)
|
||||
|
||||
func make_tick():
|
||||
current_tick += 1
|
||||
if current_tick >= tics_per_second:
|
||||
current_tick -= int(tics_per_second)
|
||||
tick.emit(current_tick)
|
Loading…
Add table
Add a link
Reference in a new issue