Page 1 of 1
Usage example for timer?
Posted: Tue Dec 27, 2011 2:46 pm
by gordebak
For example, I have an explosion animation for my character. It's fine. But if I want to do something when the character dies, like showing a text or image, it happens immediately. I want my explosion animation finished before anything happens. Should I use timer for this?
Re: Usage example for timer?
Posted: Tue Dec 27, 2011 3:35 pm
by richapple
You can:
1. Try to write a timer for yourself. (It can be easy if you won't use it a lot, but It can be tedious and It would be much easier and time-saving to choose second way)
2. Use a timer library by kikito called cron or Hump.timer by vrld.
Cron
Cron has some useful functions like:
Code: Select all
cron.after(time, callback) will execute callback after the given amount of time
Code: Select all
cron.every(time, callback) will repeat the same action periodically
You can download cron.lua
at github,
view tutorial
here
or
here.
Hump (Helper Utilities for Massive Progression):
I didn't use hump.timer yet but you can read documentation and tutorials about hump
here
and download
here
Hope this helps!
Re: Usage example for timer?
Posted: Wed Dec 28, 2011 9:00 am
by gordebak
Thanks, it seems like what I needed.