Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Node2D
- var timer = 0
- #sometimes for good measure I put a limiter
- var limiter = 12 #to measure 1 second
- func _ready():
- set_process(true)
- pass
- func _process(delta):
- timer +=1
- if timer >= limiter:
- print("do thing")
- timer = 0
- "do other things that don't need timer"
- #`[Python] var timer = 0 #sometimes for good measure I put a limiter var limiter = 60 #to - Pastebin.com`
- #* turtleman_ has quit (Quit: Leaving)
- #<dc1a0> that simple enough?
- #<otorp2> yes thanks very interesting
- #<dc1a0> if you use delta you have to think of it in terms of 1/60 or 0.0166667
- #<dc1a0> if target fps is 60
- #<otorp2> ah i will mess around with this - thanks!
- #no problem. I think it makes an easier timer to work with too imo. because for half second (2 times / second) limter = 30
- #for 2 seconds limiter = 120
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement