Simply setting image sheet or sprite sheet frame? Possible?

I have some sprites that literally only have two frames and I need to switch between them based on user activity. But as best I can tell from Beebe’s tutorial, the frame data is read only?

Is there a way to simply set the frame? (Or maybe a way to play an animation in reverse?) Neither seems possible but it’s entirely possible I’m missing something.

Cheers :slight_smile: [import]uid: 41884 topic_id: 26462 reply_id: 326462[/import]

Hey Richard,

Are you using the new sprite API or the “old” sprite API? [import]uid: 52491 topic_id: 26462 reply_id: 107390[/import]

The new stuff. Always the new stuff for me! :slight_smile:

I’m guessing maybe the only way is to make a custom animation frame table with reverse order, and then detect which frame it is? Seems like an awful lot of work just to flip frames…

EDIT: Oh, I guess you can’t do that.

When I specify a frame order that does not go forward, even partially, I receive a warning that Corona is attempting to reference frame index 0 and the frame sequence sort of randomly sputters. [import]uid: 41884 topic_id: 26462 reply_id: 107406[/import]

Yep, it’s possible. :slight_smile: I recently covered this with another user; scroll down to comment #15 and onward in the following discussion:

https://developer.anscamobile.com/forum/2011/12/05/best-way-change-images-touch

The key is, you still need to make the object into a sprite. You can’t just swap frames from an image sheet directly. Once it’s a sprite, you can set the frame with one command.

Hope this helps,
Brent Sorrentino
Ignis Design [import]uid: 9747 topic_id: 26462 reply_id: 107451[/import]

Perfect! Thanks Brent! I was hoping for a frame setting command but lost hope since the API Docs and the Tutorial both do not discuss it.

The frame order thing…I guess I should submit that as a bug? OOO frames seems like a really obvious thing to have given how we need to manually set frame order in the sequence table… [import]uid: 41884 topic_id: 26462 reply_id: 107513[/import]