How to specify an out of order frame-sequence for sprite animation, like 1,3,4,7 ?

…remember reading about it as being a new feature, but for the life of me I cannot find it back…

Thanks, Frank. [import]uid: 8093 topic_id: 6869 reply_id: 306869[/import]

Just set the currentFrame property. [import]uid: 3953 topic_id: 6869 reply_id: 23991[/import]

Sorry, maybe I wasn’t clear.

I have a spritesheet and I want to play an animation that shows first sprite/tile 1, then 3, then 4, then 7… so not a continuous sequence, not in order.

How do I do/specify that?

-FS.
[import]uid: 8093 topic_id: 6869 reply_id: 24001[/import]

i don’t remember seeing anything specific for that… presumably you want like [lua]anim = {1,4,6,9,11}[/lua]

SpriteGrabber might help a bit
http://developer.anscamobile.com/code/spritegrabber-spritesheets-two-lines

but it’s not exactly what you want. maybe you’re confusing it with the MovieClip newAnim
http://blog.anscamobile.com/2010/06/improved-movieclip-library/

why don’t you ask Magenda nicely if he can add this feature to SpriteGrabber :slight_smile:
[import]uid: 6645 topic_id: 6869 reply_id: 24057[/import]

If you mean automatically, then no, I don’t think so.

But what I do is create a sequence as jmp909 suggested, then set currentFrame in an enterFrame handler. You have to do your own timing, but it’s trivial. And it’s much more flexible than using contiguous sequences and constant frame timing. [import]uid: 3953 topic_id: 6869 reply_id: 24082[/import]

I’m referring to this enticing, new, and undocumented function “newSpriteMultiSet()”, which is hinted at “http://developer.anscamobile.com/reference/index/spritenewspriteset”:

[lua]Sprites can now use multiple sprite sheets and can define sprite sets with frames in any order. The new function sprite.newSpriteMultiSet is used to create a sprite set from any number of sheets. An example is:

local evenSheet = sprite.newSpriteSheetFromData( “even.png”, require(“even”).getSpriteSheetData() )
local oddSheet = sprite.newSpriteSheetFromData( “odd.png”, require(“odd”).getSpriteSheetData() )

– This set is a series of frames from both sheets.
local spriteSet2 = sprite.newSpriteMultiSet(
{
{ sheet = oddSheet, frames = { 1, 2, 3, 4, 5 } }, – Frames from one sheet
{ sheet = oddSheet, frames = { 3, 3, 3 } }, – Frames may be duplicated
{ sheet = evenSheet, frames = { 1, 4, 2, 3 } }, – Frames from another sheet in any order
}
)[/lua]

So maybe the Q is really… ANSCA, please provide some real documentation for this API?

-Frank.
[import]uid: 8093 topic_id: 6869 reply_id: 24098[/import]