object:reverse() only for Movieclips?

I’m working on a spriteset, which need to be played from actual Frame to Frame X forward or (if nearer in Animation-Phase) backwards.
I’ve found the object:reverse()-Function and used it for my Sprite, but got a runtime error (attempt to call method ‘reverse’ (a nil value)).
In the API-Docs the Funktion is described: “Starts the animated sprite playing in the Reverse direction”

  1. Is this function only for Movieclips?
  2. How to realize without ‘reverse’ a seamless animation for a rotating cannon-sprite, which should align on a moving enemy?
    Could anybody give me an advice, I’m a newbee in Corona.
    [import]uid: 88516 topic_id: 21457 reply_id: 321457[/import]

That particular function is only for movieclips.

Although this can be done in different ways it is often easier just to make a sheet that includes the frames in reverse order - is that an option for you?

Peach :slight_smile: [import]uid: 52491 topic_id: 21457 reply_id: 85148[/import]

thanks @peach
I already looked after alternatives (like the MultiSpriteSet and additional sheets) but I’m not sure how exactly replace seamless my first forward sheet with a second backward sheet.
Is there any Sample code for this situation?
And is sheet-flipping an option with enough performance (it will used in several instances simultaneously) or should I take the way trough movieclips better?
Thanks for advice from experienced devs like You!
[import]uid: 88516 topic_id: 21457 reply_id: 85209[/import]

Hey again,

You could still use one sheet if it were within the size limits. How big is the sheet right now? If doubling the number of frames were an option then this would be REAL easy.

There aren’t a lot of examples for this kind of thing but a rough example to look at would be a character walking around - there’s a tutorial on that, uh… here: http://techority.com/2011/05/01/using-sprites-in-your-corona-iphone-application/

Let me know if that is any help.

Peach :slight_smile: [import]uid: 52491 topic_id: 21457 reply_id: 85279[/import]

I also needed to control the animation frames more directly so what I did was to set the original sprite animation to loop indefinitely and then set up a sprite event handler and checked for event.phase == “next” and event.phase == “loop”. When those events happened I simply “jammed” the sprite.currentFrame from a table and updated an index.
That way I could basically have several different animation sequences from one set of sprite graphics.
It was little clunky and I wish Corona had a better way to select different animation frame sequences but until then this method works fine without using excessive texture memory. [import]uid: 108253 topic_id: 21457 reply_id: 85836[/import]