Access to a sprite's "time" setting please?

I didn’t receive any responses to my query in the Game Dev forum, so I’m guessing it’s not possible (or not known by most users) how to access/change a sprite’s TIME setting. Could this be added to a future build Ansca? It seems like a fairly simple addition, but then, I’m just an end user, not one of the architects. :slight_smile:

Similar to spriteInstance.animating, it would be great to have spriteInstance.time. This would simply allow the user to set/get the current speed of an animating sprite *during runtime*.

Why do I propose this functionality? Let’s say you have the “horse running” animation. If you want to speed up the animation during runtime, it’s not easily done under any method I have discovered, and nobody in the Game Dev forum suggested a solution so I assume it’s not possible at all.

The monkey-wrench solution I’m using now is to create 2 separate sprite configurations running at two different speeds (but using the same sheet). Like this:

sprite.add( runningSet, "slow", 1, 7, 300, -2 ) sprite.add( runningSet, "fast", 1, 7, 100, -2 )
In my game, when I want to speed up the animation, I switch the character from the “slow” animation to the “fast” animation. I also use sprite.currentFrame to synchronize the switch… i.e. if it was on frame 5 in “slow” I set it to frame 5 in “fast” so the runner is in the same position on animation change.

Unfortunately, this still causes a problem. Notice that I use “-2” as the looping parameter, so the animation bounces back-and-forth infinitely: 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1. When I switch from one speed to another, Corona doesn’t know if the sequence is going “forward” or “backward”. I can detect if it’s on frame 5, but I can’t detect if the NEXT frame will be 6 or 4. So, it messes up the animation, always starting the switched animation going forward, when sometimes it should be going backward!

Access to the sprite’s “time” setting would solve all of this, and provide better sprite animation control overall. With this parameter, I could set the speed to any number I wanted during runtime, and the sequence would continue as normal, in the proper direction, just with a new speed. Ansca, please consider adding this to your upcoming features! :slight_smile:

Thanks!
Brent Sorrentino
Ignis Design
[import]uid: 9747 topic_id: 10278 reply_id: 310278[/import]