I’m making a game for the iPhone3. I got spritesheets done for a 480x320 resolution.
Now, when i make my second set of spritesheets, all x2 in size, and try loading them into the game, they just don’t appear on screen.
Everything is set fine in my config.lua since display.newImageRect is working fine.
In order to detect which spritesheet to use (normal or retina support) i detect the device and then, according to this, i load the foo.png spritesheet or the foo@2x.png spritesheet.
Is there something else i’m missing?
Cause it should be pretty straight forward.
Running on 480x320, loading the normal spritesheet, appear in correct positions on screen.
Running on 960x640, loading the HD spritesheet, can’t see anything :S
Please help!! Thank you [import]uid: 105206 topic_id: 22845 reply_id: 322845[/import]
Dynamic spritesheet scaling does not work with the current Sprite API as of build 758. You’ll have to programmatically scale things by detecting the difference in your content scale with display.contextScaleX and display.contentScaleY, load the appropriate sheet, and scale your display objects to match the contentScaling.
I implemented this in Spriteloq, and it’s being used successfully by lots of devs. And there are quite a few posts on this topic do a search via google.
The new Sprite API currently in the works will have dynamic sprite scaling, but the details aren’t out yet. [import]uid: 27183 topic_id: 22845 reply_id: 91313[/import]
@don,
Thanks for your reply.
I already detect the device and scaling, and manually load the appropriate sheet.
I use TexturePacker to generate them.
My problem is that when it loads the “@2x” sprite sheet on the iPhone 4 or iPad, content appears even more scaled! I have to scale things on a 0.4 factor in HD devices in order to get the sprites in the correct size, while in standard, everything shows up right just from startup.
I have no idea what can be causing this, i’m sure my config file is ok…
[import]uid: 105206 topic_id: 22845 reply_id: 91353[/import]
Hi nml,
What you’re doing is the “standard” practice. You detect, load the appropriate sheet, and then have to rescale because what’s happening is that Corona is scaling the coordinate system. You need to “anti-scale” because you’re loading the appropriate sheet.
Dynamic spritesheet scaling is not supported with the current Sprite API but so we have to resort to this. In the future, we won’t have to do this with the new Sprite API. [import]uid: 27183 topic_id: 22845 reply_id: 91354[/import]