I just released version 1.3 of my BeebeGames Class today, and here are the new features:
* A total of 6 new functions (and 2 new methods) that all have to do with time and timers.
* A replacement for timer.performWithDelay() that will allow you to pause/resume your timers.
* A table that will hold all active timers (that were created with the new function) as well as functions that will allow you to pause, resume, and cancel all timers easily with one line of code respectively.
Here’s a tutorial that goes over everything that was added today:
Jon, thank you so very much! My vote goes to you for the Corona Developer of Year award!!! Happy holidays [import]uid: 11904 topic_id: 4682 reply_id: 14820[/import]
This grab bag of code you’re providing is really helpful; commaThousands() and newRetinaText() are both pretty clever!
I’m a little leery of these timer functions though, because you’re using enterFrame listeners to count the frames. That only works for timing if the framerate is rock solid and, well, it might not be.
I’ll probably write my own timer class with pause() resume() and cancel() methods just like you did because that is really convenient. [import]uid: 12108 topic_id: 4682 reply_id: 16049[/import]
Thanks for the continued contributions Jon! I just yesterday wrote my own “timer pause” function, which isn’t as open-ended as yours (it just works for one primary swapping timer, which is all that I need it for at the moment). Mine uses system.getTimer() like jhocking’s above, which might (or might not) be more accurate… really hard to determine without extensive testing.
For all those facing this dilemma in their game, remember that Ansca has true transition pausing (and quite possibly Timer pauses) as a “top priority” in the roadmap. That means it’s probably coming fairly soon. It’s not wise to outright delay your game waiting for this… by all means, use Jon’s function or write your own Timer pause function… but my own opinion is to not worry excessively about this because Ansca is probably adding this feature sooner than later. I’m going to continue to use my custom function and work on other game aspects in the meantime. [import]uid: 9747 topic_id: 4682 reply_id: 16060[/import]
Frame-based transitions are fine with me, because if the frames are lagging behind, I always assume in-game time should lag with it (or things might get screwed up)… but that’ just me, and my personal needs.
I agree with IgnisDesign, just look at all these as temporary fixes until the “real thing” gets released by Ansca
Btw, version 1.7 was released today and includes an EASY way to make use of pregenerated random tables (saves on performance for apps that use a lot of math.random calls).
Can someone give me some example code? im having trouble, all im doing is creating a timer and trying to get it to display on screen… do i want to create a Runtime listener for a function that calls local timePassed = getCountedTime( timeCounter )
and then display the result in a textobject? [import]uid: 19620 topic_id: 4682 reply_id: 22794[/import]