animation (and function) sequencing

I want to create a “game” that instead of being event-driven is mostly theater-style action; a sprite moves, then another sprite moves, then both sprites move at the same time, then the first sprite moves, etc. What’s the strategy for doing sequencing like this? I’d really rather avoid a massive callback chain, if possible (at least in the code - if it gets generated that’s fine). I guess a state machine would be fine, but klunky. I tried to do something with coroutines in which animation transition onComplete callbacks would yield, but that won’t work because of the metamethod/C-call boundary.

Has anyone done this, or has any ideas? [import]uid: 4686 topic_id: 1511 reply_id: 301511[/import]

Anybody?

I can easily do this in competing frameworks, for example in cocos2d. I can’t believe there isn’t a strategy for doing this in corona. [import]uid: 4686 topic_id: 1511 reply_id: 4270[/import]

> theater-style action; a sprite moves, then another sprite moves, then both sprites move at the same time, then the first sprite moves, etc. What’s the strategy for doing sequencing like this?

What is going to control which sprite moves when? How many sprites? How long is each sequence?

Assuming a fixed # of sprites and a limited number of moves, if I were doing it, I would create a data structure that had the following parameters: which sprite moves, what amount it moves (x,y), and the time it takes to move. There’d be a (global) data structure that contains the current move. A function would be called to initiate the next move. Finally, start a move by using a transition.to with a listener for the end of the move. Or if the moves overlap, use timer.performWithDelay to wait until the appropriate time.

I guess you’d call it a state machine, but that’s what comes to my mind. It really depends how complex the moves are.

[import]uid: 54 topic_id: 1511 reply_id: 4303[/import]