App crashes because of Sprite Sheet???

Hey so my app has run smoothly up until now and I haven’t touched the spritesheets in over a month. It freezes when I hit the play button but ONLY on the device NOT the simulator. So I ran Logcat and this is the Runtime Error that I got:

I/Corona ( 1944): Lua Runtime Error: lua_pcall failed with status: 2, error message is: ERROR: Invalid parameter passed to sprite.newSpriteSheetFromData(). Frame overlaps sprite sheet.

This is my spritesheet code:

local sheet1 = sprite.newSpriteSheet( "catWalking.png", 52, 109 )  
  
local spriteSet1 = sprite.newSpriteSet(sheet1, 1, 1)  
sprite.add( spriteSet1, "cat", 1, 8, 700, 0 ) -- play 8 frames every 1000 ms  
  
local instance1 = sprite.newSprite( spriteSet1 )  
instance1.x = 0 --display.contentWidth / 4 + 40  
instance1.y = 0 --75  
  
instance1:prepare("cat")  
instance1:play()  

and my spritesheet image is 512 x 512.
Does anyone know why this freeze might happen??? [import]uid: 14461 topic_id: 20019 reply_id: 320019[/import]

sprites arent exactly my speciality so i may be wrong here… But im pretty sure this line:

local spriteSet1 = sprite.newSpriteSet(sheet1, 1, 1)

should have the max amount of frames you have on the sheet, instead of 1. eg:

local spriteSet1 = sprite.newSpriteSet(sheet1, 1, 8)

It may just be bugging out because youve only said the sheet has 1 frame, but yet your trying to play 8 for the cat. Let me know if that helps at all! [import]uid: 69826 topic_id: 20019 reply_id: 78115[/import]

Alright I tried changing that but I still get this error:

I/Corona ( 2067): Lua Runtime Error: lua_pcall failed with status: 2, error message is: ERROR: Invalid parameter passed to sprite.newSpriteSheetFromData(). Frame overlaps sprite sheet.
[import]uid: 14461 topic_id: 20019 reply_id: 78129[/import]

Can you upload this and provide a link, if you’re comfortable doing that?

One of us may be able to better assist you that way.

Peach :slight_smile: [import]uid: 52491 topic_id: 20019 reply_id: 78248[/import]

I think I’ll just see If one of my friends knows whats wrong. I Don’t really feel comfortably giving my project sorry :frowning: [import]uid: 14461 topic_id: 20019 reply_id: 78357[/import]

That’s fine - if you do decide to upload no one would have to see a full project, only the sprite image and code so they could run it.

Alternatively you could butcher the sprite (scribble all over it or whatever) while keeping it the same size, that would work too.

In any case if your friends can assist you in fixing it, that’s obviously a great option too.

Peach :slight_smile: [import]uid: 52491 topic_id: 20019 reply_id: 78445[/import]

Alright If I solve the problem I’ll reply with the cause and solution :slight_smile: and If I don’t than I’ll just do what you said and upload a butchered version [import]uid: 14461 topic_id: 20019 reply_id: 78622[/import]

Great, best of luck with it - will be here if you need assistance :slight_smile:

Peach [import]uid: 52491 topic_id: 20019 reply_id: 78644[/import]