Hello,
I was reading a blog about the sprites animation by Brent which was very helpful. Is there any way to tell the animation what frames to play by code? The code below tells it in the sequenceData to play 1,2,3,4,5,6,7 frames. But I may want only 4,5,6,7 to play. I know I could create different sequenceData fields and use what is needed but I would rather just know how to do this if it is possible. I may want a character to show one set of frames until it is killed or some other action. And then play the frames for the new action.
Thanks,
Warren
local sheetData = { width=512, height=256, numFrames=8, sheetContentWidth=1024, sheetContentHeight=1024 }
local mySheet = graphics.newImageSheet( "runningcat.png", sheetData )
local sequenceData = {
{ name = "fastRun", frames={ 1,2,4,5,6,7 }, time=250 }
}
local animation = display.newSprite( mySheet, sequenceData )
animation.x = display.contentWidth/2 --center the sprite horizontally
animation.y = display.contentHeight/2 --center the sprite vertically
animation:play()
[import]uid: 184193 topic_id: 36701 reply_id: 336701[/import]