Reputation: 103
So I am working on a game with Godot. It is an infinite runner, so I need to spawn in a platform ahead of the player every few seconds. The timer node was confusing, so I just made a variable and added delta to it in _process. However, It didn't seem to work. Then I tried assigning a variable to delta and then printing delta and the variable, like this:
print(delta)
de = delta
print(de)
then I get an output like this:
0.16667 0 0.16667 0
which signifies that delta isn't being added to a variable. What can I do to try and fix this and why is it happening?
Upvotes: 1
Views: 353
Reputation: 800
I believe you wanted this:
var timer = 0.0
func _process(delta):
timer += delta
if timer > 1.0: # after one second passed
# reset the timer and do something here
timer = 0.0
Upvotes: 2