Spritesheet problems - crashing simulator

Hi, my first topic here at the forum, and I hope that I posted it in the right forum. I have been struggling with this for two days now and cant get it to work.

I am having problems with the code below. It crashes the simulator and when I trace the frames it goes way to far? Any suggestions?

I am using two different spritesheets with ten different animations btw.

  
require "sprite"  
  
flyRightSheet = sprite.newSpriteSheetFromData( "right.png", require("right").getSpriteSheetData() )  
  
flyLeftSheet = sprite.newSpriteSheetFromData( "left.png", require("left").getSpriteSheetData() )  
spriteSet1 = sprite.newSpriteMultiSet(   
{  
 { sheet = flyRightSheet, frames = { 1,2,3,4,5,6,7,8,9,10 } },  
 { sheet = flyLeftSheet, frames = { 1,2,3,4,5,6,7,8,9,10} },  
}  
)  
  
sprite.add(spriteSet1,"right",1,10,1000,0)  
sprite.add(spriteSet1,"left",11,20,1000,0)  
spriteInstance = sprite.newSprite(spriteSet1)  
spriteInstance:setReferencePoint(display.BottomCenterReferencePoint)  
spriteInstance.x = 175;  
spriteInstance.y = 350;  
   
spriteInstance:prepare("left")  
spriteInstance:play()  

Any help would be nice!

Best regards, Joakim [import]uid: 81188 topic_id: 15035 reply_id: 315035[/import]

Hi. What size are your spritesheets? [import]uid: 84637 topic_id: 15035 reply_id: 55612[/import]

Hi,

The spritesheet is 1024 x 512.

Joakim [import]uid: 81188 topic_id: 15035 reply_id: 55654[/import]

Ok, i have tried twenty more times with different sizes of the sheet and a low amount of frames, but this is still crashing.

My latest attempt was two sheets 512x512 px and with 5 frames each. Works fine as long as I just runs the first sequence, but when I try to run the second sequence - simulator crash and die :frowning:

Please, anyone who could try to help me find out the problem. It must be in my code?

Joakim [import]uid: 81188 topic_id: 15035 reply_id: 55718[/import]

hi info642, I tried your code with my sprite, the simulator crashes too. have you figure out what is the problem yet? [import]uid: 38556 topic_id: 15035 reply_id: 57776[/import]

Hi, there are one error in the code above, it should be ->

sprite.add(spriteSet1,"right",1,10,1000,0)  
sprite.add(spriteSet1,"left",11,10,1000,0)  

But Corona is not 100% stable when you have more then one sheet of sprites. Corona loses track of what frames to play - and therefore I skipped that and use only one sheet.

Joakim
[import]uid: 81188 topic_id: 15035 reply_id: 57779[/import]

I am using the following method, but not sure how much memory it needs, but I don’t know other method at this moment…sign…

http://techority.com/2011/05/01/using-sprites-in-your-corona-iphone-application/ [import]uid: 38556 topic_id: 15035 reply_id: 57895[/import]