I’m helping with an app that makes use of old style sprite sheets that were packed
with Zwoptex. I have spritesheetA which the existing program is using, but it’s scaled for smaller devices, that is the sprite looks blurry on the retina iPad. I have an @2x version of the file and I have an @2x version of the spriteSheetData produced by Zwoptex. The 1x and 2x image files have the sprites in the same order and relative packing (in other words, the 1x looks like it’s a 50% resample of the 2x version. The values in the spriteSheetData for both are in the same order, and all coordinates are 2x the 1x’s version.
In my code, I do:
local displayScale = display.contentScaleX
print("scale", displayScale)
if displayScale \< 1 then
mySS = sprite.newSpriteSheetFromData( "mySS@2x.png",
require("myData@2x").getSpriteSheetData() );
else
mySS = sprite.newSpriteSheetFromData( "mySS.png", require("myData").getSpriteSheetData() );
end
local mySet = sprite.newSpriteSet(mySS, 1, 6);
sprite.add(mySet, "a", 4, 6, 150, 1);
sprite.add(mySet, "b", 1, 3, 400, 1);
mySprite = sprite.newSprite(eddySet);
if displayScale \< 1 then
mySprite:scale(0.5,0.5)
end
I should point out, the above has been modified for demo purposes. This is someone elses program so I’m not going to post the real code, sorry… There are 18 images in the sprite sheet and 7 total sequences defined…
If I don’t do any of the displayScale checks, and I only use mySS.png and it’s data set, it works like a charm, just blurry. If I use the logic above, or if I just replace mySS.png with the @2x versions, it like doesn’t finish various squences. That is if one sequence is the character jumping, it doesn’t play the last frame, then when I try to move or do any other sequence it leaves me on the next to the last frame of the first thing I did (jumping).
The remaining mySprite:prepare() and mySprite:play()'s should do what it needs to do. But I don’t know why this is misbehaving.
Any thoughts?
Help!
[import]uid: 19626 topic_id: 27946 reply_id: 327946[/import]