I used the Zwoptex Flash version to generate:
- A .png texture file with -hd suffix (double sized images)
- A .png texture file without -hd suffix (normal sized images)
- A .plist file with -hd suffix.
- A .plist file with -hd suffix.
I have checked the files and everything seems to be there alright.
In my game, first I added the .plist file to the cache:
[[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:@"ParticleAnimations.plist"];
And then I created my CCSpriteBatchNode:
spriteBatch = [CCSpriteBatchNode batchNodeWithFile:@"ParticleAnimations.png"];
[self addChild:spriteBatch z:0];
And finally create my CCSprite, with the filename of an image found in my textures:
CCSprite *particle = [CCSprite spriteWithSpriteFrameName:@"Particle1.png"];
[spriteBatch addChild:particle z:0];
Now, I run this on the simulator (iPhone), and it runs just fine.
Then, I change the Hardware option and set it to “iPhone (retina)”, which transforms the simulator on a 960×640 screen. But then, my gane crashes. Within the log, here are these entries:
cocos2d: CCSpriteFrameCache: Trying to use file ‘ParticleAnimations.png’ as texture
cocos2d: CCSpriteFrameCache: Frame ‘Particle1.png’ not found
Which I don’t quite understand. First of all, why is it using ParticleAnimations.png instead of ParticleAnimations-hd.png, since it is in Retina Display mode? And, of course, why is it looking for Particle1.png instead of Particle1-hd.png?
To begin have you think to uncomment these lines into you appdelegate:
It’ll enable Cocos2d to use the -hd files.
Then your sprite names must be exacty the same into your spritesheets. Just the plist and texture files must have the “-hd” suffix. For example if you have sprites named toto.png, titi.png, tata.png into your spritesheets named mysp it should look like that:
For more information, you should refer to the official documentation here: RetinaDisplay in cocos2d
I hope it’ll help you!