Hi everyone!
I am building a small pong clone and I would like the game to pause for 2 or 3 seconds whenever a player is scoring.
I saw that there are out there timer class but, since it was not easy for me to implement that, I wanted to ask if there is a simpler way to achieve this result.
Thanks!
P#38676 2017-03-24 09:06 ( Edited 2017-03-24 23:17)
timer=0 is_happening=false SOME_LIMIT=60 -- 30 = 1 second with _update() running at 30FPS. function _update() timer+=1 if timer>=SOME_LIMIT and not is_happening then -- After two seconds, do something. do_something() is_happening=true timer=0 end end |
P#38677 2017-03-24 09:42 ( Edited 2017-03-24 13:52)
[Please log in to post a comment]