I'm curious about something and was wondering what opinions were. Starling sends an enter frame event every game tick right? If you pass that event through your classes using passedTime to keep everything on the same millisecond is that better or worse than having classes with their own timers keeping their own time to update themselves. Any thoughts?
EnterFrameEvent vs. Timer?(4 posts) (3 voices)
Since you are talking about time, Starling also has a simple IAnimatable interface which you can implement on any of your classes that will then get a call of advanceTime(time:Number) if you add them to Starling's active Juggler or if you build a system of dependent jugglers that you add and remove as needed. Starling also already has its own timer class of DelayedCall.
One of the benefits of hooking into the Starling Juggler system is you automatically get support for pausing/stopping/resuming all by just calling Starling.start/stop without having to mess with multiple different timers of your own.
So if you are making a mobile app and you start/stop when the app goes to the background, you are always guaranteed the juggler system and any of your IAnimatable calls of advanceTime(time:Number) are consistent as a whole system already.
Just a suggestion to look into if it may end up saving you time and coding:
Agree with Jeff. I think using juggler is good if you want to keep your animation/action sync with the other starling stuff.
In my opinion, using individual timer in a game is not a good practise, even using other language.
That's absolutely what I was looking for, thanks! Making these classes implement IAnimatible and using a Juggler will fix this whole mess. Thanks again!
You must log in to post.