Hello.
To build all my spritesheets, I use TexturePacker. My plan is to support 320x480 and 640x960 resolutions on the iPhone.
My config is pretty simple and looks like this:
[lua]application = {
content = {
width = 320,
height = 480,
scale = “letterBox”,
fps = 30,
imageSuffix = {
["@2x"] = 2,
}
},
}[/lua]
what I do is build the 640x960 sprites first, saving the png with the suffix @2x and then use TP to scale it to half size and save it with the normal file name.
But when testing on simulator, it always uses the normal images and not the @2x spritesheets.
My code to loading and using the sheets is like this:
[lua]–get all sprite data
–script generated by texturepacker
local heroSheetData = require(“scripts.herosheet”);
local heroData = heroSheetData.getSpriteSheetData();
–sheet created by texturepacker
local heroSheet = sprite.newSpriteSheetFromData( “images/herosheet.png”, heroSheetData.getSpriteSheetData() );
local heroSet = sprite.newSpriteSet(heroSheet, 1, 16);
–prepare animations
sprite.add(heroSet, “death”, 1, 3, 800, 1);
sprite.add(heroSet, “falling”, 4, 1, 1, 1);
sprite.add(heroSet, “jumping”, 5, 1, 1, 1);
sprite.add(heroSet, “sliding”, 6, 1, 1, 1);
sprite.add(heroSet, “rolling”, 7, 3, 200, 0);
sprite.add(heroSet, “running”, 10, 7, 400, 0);[/lua]
(Seems I missed the existence of the 3rd Party Tools and Services sub-forum. It doesn’t seem to be updated often though, if a moderator decides to move it then I guess it’s ok…) [import]uid: 136402 topic_id: 30336 reply_id: 330336[/import]