I am trying to use this, but I have problems with any scale factor other than 1:
local obj = display.newGroup();
local suffix = "";
local displayScale = display.contentScaleX;
print("scale: " .. displayScale)
if displayScale \< 1 then --this way it scales for iPad as well as iPhone
suffix = "@2x"
end
local catSprites = spriteGrabber.grabSheet("catsprites"..suffix);
local cat = catSprites:grabSprite("",true,{run={1,8,1000,0}});
cat.x, cat.y = 0 , 0;
obj:insert(cat);
cat(0,0,displayScale,"c") --also tried "tl"
cat("run");
If I manually set displayScale to 1, the animation plays fine. But if I let the simulator set it (which will give 0.46875 for the iPad), the sprite animation plays, but also bobs up and down while it’s animating. It stays in place if displayScale = 1. Why would this happen?
All of the images in the sprite sheet have the same spriteSourceSize. [import]uid: 52127 topic_id: 10938 reply_id: 310938[/import]
You had omitted :show() and :playClip() functions in your code…
If you still have issues with this, plz upload a demo project somewhere (e.g. dropbox) so I can further help you. Make sure you include your config.lua file within the project zip.
I am encountering some network problems, so I will take a look at the files tomorrow.
In the meantime, search the forum for “why the sprite library needs urgent debugging”. I have included a bug there that reminds me of what you are describing…
I am answering here, where the demo link is placed, just for future reference of other users.
First of all, your code (as is) runs properly only on ipad. You don’t give a spritesheet for displayScale==1
Thank you, using “Untrim” in Zwoptex fixes the problem, at least on this particular sprite. [import]uid: 52127 topic_id: 10938 reply_id: 40024[/import]