sprite Multiple Image Sheets problem .

I have lots of frame files of an animation.(241 frame Extracted from a gif file)

I want to burst into a sprite images I display.

I used a sample document named “Multiple Image Sheets” But it does not work.

I use the similar code, but it does not work. Please help me to write the correct code.

local sheet1 = graphics.newImageSheet( "birdseq/frame-001.png",{ width=460, height=135, numFrames=1}) local sheet2 = graphics.newImageSheet( "birdseq/frame-002.png",{ width=282, height=122, numFrames=1}) local sheet3 = graphics.newImageSheet( "birdseq/frame-003.png",{ width=270, height=121, numFrames=1}) local sheet4 = graphics.newImageSheet( "birdseq/frame-004.png",{ width=256, height=118, numFrames=1}) local sheet5 = graphics.newImageSheet( "birdseq/frame-005.png",{ width=242, height=116, numFrames=1}) local sheet6 = graphics.newImageSheet( "birdseq/frame-006.png",{ width=230, height=114, numFrames=1}) local sheet7 = graphics.newImageSheet( "birdseq/frame-007.png",{ width=217, height=114, numFrames=1}) local sheet8 = graphics.newImageSheet( "birdseq/frame-008.png",{ width=203, height=113, numFrames=1}) local sheet9 = graphics.newImageSheet( "birdseq/frame-009.png",{ width=192, height=113, numFrames=1}) local sheet10 = graphics.newImageSheet( "birdseq/frame-010.png",{ width=180, height=113, numFrames=1}) local sequenceData = { { name="seq1", sheet=sheet1, start=1, count=10, time=100, loopCount=0 ,loopDirection = "forward"}, { name="seq2", sheet=sheet2, start=2, count=10, time=100, loopCount=0 ,loopDirection = "forward"}, { name="seq3", sheet=sheet3, start=3, count=10, time=100, loopCount=0 ,loopDirection = "forward"}, { name="seq4", sheet=sheet4, start=4, count=10, time=100, loopCount=0 ,loopDirection = "forward"}, { name="seq5", sheet=sheet5, start=5, count=10, time=100, loopCount=0 ,loopDirection = "forward"}, { name="seq6", sheet=sheet6, start=6, count=10, time=100, loopCount=0 ,loopDirection = "forward"}, { name="seq7", sheet=sheet7, start=7, count=10, time=10, loopCount=0 ,loopDirection = "forward"}, { name="seq8", sheet=sheet8, start=8, count=10, time=100, loopCount=0 ,loopDirection = "forward"}, { name="seq9", sheet=sheet9, start=9, count=10, time=100, loopCount=0 ,loopDirection = "forward"}, { name="seq10", sheet=sheet10, start=10, count=10, time=100, loopCount=0 ,loopDirection = "forward"} } myAnimation = display.newSprite(sheet1 ,sequenceData ) myAnimation.x = display.contentWidth/2 ; myAnimation.y = display.contentHeight/2 myAnimation:play()

Hi @psmohsen,

Thank you for posting the code, but can you be more specific about what is “not working”? This way, the community and staff will have some guidelines to assist you better.

Thanks,

Brent

@Brent : Thank you for your response.

I’ve prepared a sample.

For example, I want 10 frames of the project, such as a gif file, sequential display and repeat.

I’m sure my code have a problem that these correctly will not run.Please help me to write correct and optimized code.

In this forum, why do not you answer correctly?

I’ve sent my codes, but it did not work. You said further comment.I sent Additional Details + a sample is too small.

What should I do until you help me?

Hello @psmohsen,

I received your project but I usually don’t work on the weekends. Now that it is Monday, I can help you.

When I look at your sample, I don’t understand what your goal is. Do you want to animate “frame-001.png” through “frame-010.png” in sequence? If so, you should put all of those frames on the same image sheet (not on separate sheets).

The concept of using multiple image sheets is to have different animated sequences pulled from different sheets… not just 1 frame from 1 sheet.

Hope this helps somewhat,

Brent

Thanks for your response.

But my frames are separate files and have different sizes.How do I use all of them on one sheet?

I understand your situation, you’re busy. But please help me with the coding language. Now I am confused and do not know how I can use your help in my project.

Hi @psmohsen,

Can you just assemble every frame on one sheet (one image)? It’s OK to have different frame sizes… you just need to define those frames when you set up the image sheet. It will use the “Complex” example shown in the documentation:

http://docs.coronalabs.com/api/library/graphics/newImageSheet.html

Hope this helps,

Brent

Thanks Brent ,

The frames size is large.

The number of frames is high. (241)

I can not assemble them all in one picture.

Is there another way?

If the solution is hard, I do not problem.

I just want Gif file frames Sequentially displayed , repeated and optimized.

Hi @psmohsen,

OK, for this high number of images (241), you may consider a different approach. In the sample you sent to me, I noticed that there are several “birds” with a lot of empty white/transparent space between. Can you create each “bird” as its own small sprite and animate them individually? I know this would be a lot of effort initially, but it would be easier to manage for the entire project.

If you need to keep 241 frames of this size, you may encounter limits on the texture memory of real devices, which may crash the entire program.

Best regards,

Brent

Hi @psmohsen,

Thank you for posting the code, but can you be more specific about what is “not working”? This way, the community and staff will have some guidelines to assist you better.

Thanks,

Brent

@Brent : Thank you for your response.

I’ve prepared a sample.

For example, I want 10 frames of the project, such as a gif file, sequential display and repeat.

I’m sure my code have a problem that these correctly will not run.Please help me to write correct and optimized code.

In this forum, why do not you answer correctly?

I’ve sent my codes, but it did not work. You said further comment.I sent Additional Details + a sample is too small.

What should I do until you help me?

Hello @psmohsen,

I received your project but I usually don’t work on the weekends. Now that it is Monday, I can help you.

When I look at your sample, I don’t understand what your goal is. Do you want to animate “frame-001.png” through “frame-010.png” in sequence? If so, you should put all of those frames on the same image sheet (not on separate sheets).

The concept of using multiple image sheets is to have different animated sequences pulled from different sheets… not just 1 frame from 1 sheet.

Hope this helps somewhat,

Brent

Thanks for your response.

But my frames are separate files and have different sizes.How do I use all of them on one sheet?

I understand your situation, you’re busy. But please help me with the coding language. Now I am confused and do not know how I can use your help in my project.

Hi @psmohsen,

Can you just assemble every frame on one sheet (one image)? It’s OK to have different frame sizes… you just need to define those frames when you set up the image sheet. It will use the “Complex” example shown in the documentation:

http://docs.coronalabs.com/api/library/graphics/newImageSheet.html

Hope this helps,

Brent

Thanks Brent ,

The frames size is large.

The number of frames is high. (241)

I can not assemble them all in one picture.

Is there another way?

If the solution is hard, I do not problem.

I just want Gif file frames Sequentially displayed , repeated and optimized.

Hi @psmohsen,

OK, for this high number of images (241), you may consider a different approach. In the sample you sent to me, I noticed that there are several “birds” with a lot of empty white/transparent space between. Can you create each “bird” as its own small sprite and animate them individually? I know this would be a lot of effort initially, but it would be easier to manage for the entire project.

If you need to keep 241 frames of this size, you may encounter limits on the texture memory of real devices, which may crash the entire program.

Best regards,

Brent