ShAkInG Sprite Sheet problem!

Hey all !

Im new to using sprite sheets, and ive encourtered an anoying problem. Whenever i play my sprite animation, the animation shakes. As if the frames it takes from the sheet.png are off in size. I know for a fact that individual sprites are all 100*100, but the animation seems to shake less when i tell CORONA that the sprites are smaller. The problem gets less when downsizing, but at some point corona crashes, telling me: "sequence frames must be inside the sheet
".

Ive downloaded spriteHelper to build my sheets but i dont think thats the problem. the software seems to work fine. Im using this code, just to test the spriteSet and which gives me the problem:

[lua]require “sprite”

local sheet = sprite.newSpriteSheet(“duckBlink-hd.png”, 94, 90)

local spriteSet = sprite.newSpriteSet(sheet, 1, 5)
sprite.add(spriteSet, “blink”, 1, 5, 800, 0)

local instance = sprite.newSprite(spriteSet, 1, 5)

instance.x = display.contentWidth/2; instance.y = display.contentHeight/2;
instance:prepare(“blink”)
instance:play()[/lua]

I would appreciate any help :slight_smile:
best regards - jcfinnerup [import]uid: 55530 topic_id: 16044 reply_id: 316044[/import]

mind posting a link to the spritesheet as well? [import]uid: 49447 topic_id: 16044 reply_id: 59586[/import]

Sure:

http://imageshack.us/photo/my-images/8/duckblinkhd.png/ [import]uid: 55530 topic_id: 16044 reply_id: 59606[/import]

The sprites certainly aren’t 100x100. I’m guessing part of your problem is that the height of the spritesheet is 272, but you have 3 rows. 272 cannot be divided evenly into 3, which might account for the issue you are having.

I noticed in the code you set the height of each frame to 90. But really, the height is something like 90.666666 [import]uid: 49447 topic_id: 16044 reply_id: 59610[/import]

Thats strange. i Used some mac-preview to resize the sprites, and i guess i didn´t question the results.
Do you think it would help to change the layout of the spriteSheet?

[import]uid: 55530 topic_id: 16044 reply_id: 59613[/import]

I don’t think the layout matters too much. As long as all your sprites are the same size, and as long as the sprite is in the same position within each 100x100 block, you should be good to go. [import]uid: 49447 topic_id: 16044 reply_id: 59616[/import]

Thanks.
I think ill try with zwoptex instead, since it seems like the sheets are fine, and though i optimize the code it still “shakes”

Regards [import]uid: 55530 topic_id: 16044 reply_id: 59617[/import]

Its all working great now. I used Zwoptex instead and its auto layout function just fixed everything.
[import]uid: 55530 topic_id: 16044 reply_id: 60189[/import]