scaling sprite sheets

I’ve looked in the forums and I’m confused as to the way to achieve this.

I have mySprites.png and mySprites@2x.png and mySprites.lua and mySprites@2x.lua created by texture packer.

I am using magenda’s cool spritegrabber class.

When I put my app on a retina display it doesn’t load the @2x sprites.

Normal @2x images are loaded fine.

Do I have to do something to tell spritegrabber to load the @2x sprites?

[import]uid: 51494 topic_id: 15726 reply_id: 315726[/import]

From what I understand, dynamic image resolution isn’t supported for spritesheet yet. I’m waiting for Ansca to implement it, and if not soon, I’m hoping that someone super smart and experienced would come up with some API/code to help us all. [import]uid: 67217 topic_id: 15726 reply_id: 58092[/import]

Pretty sure this is somewhere in the forums but here’s a way to do it.

After launch create a global variable ( I call it _G.suffix) and give it a value of an empty string ("").

Then check for display.xScale. If it is less than 1 assign the string value “@2x” to your _G.suffix var.

Whenever you create a new sprite sheet you call it as “nameOfSpriteSheet” … _G.suffix

[import]uid: 40137 topic_id: 15726 reply_id: 58095[/import]

Wow, thanks! It sounds so incredibly simple. But then… I have a feeling it may not quite work in my case, because I use Spriteloq and it comes with both PNG and LUA files for the spritesheet… Still, I’ll give it a try sometime. Thanks again! [import]uid: 67217 topic_id: 15726 reply_id: 58098[/import]

thanks. I was doing this but the sprites were then too big.

It seems that if I am using the bigger spritesheet I then have to set the sprite instance x and y scale to .5

I’m still bumbling my way through it and i’ve yet to see how this affects the physics engine. [import]uid: 51494 topic_id: 15726 reply_id: 58100[/import]