I am having a problem with my cocos2d game that supports retina display. Everything used to work fine but now i am working on an update. In this update i have only added 3 new images (also in hd). I am using texture atlases made with zwoptex. the png's generated are gameart.png and gameart-hd.png. I am loading the files using this code:
CCSpriteFrameCache* frameCache = [CCSpriteFrameCache sharedSpriteFrameCache];
[frameCache addSpriteFramesWithFile:@"gameart.plist"];
when getting any sprite i am using spriteWithFrameName: method. Everything used to work fine before (Even on iPhone 4) but now i am getting the following error only on iPhone 4:
cocos2d: CCSpriteFrameCache: Frame 'tilei.png' not found
*** Assertion failure in -[BoardTile initWithSpriteFrame:]
the file tilei is available in both gameart.png and gameart-hd.png (tilei.png and tilei-hd.png) and the plist files. i rechecked it a thousand times. what could be going wrong? notice that the error is not showing the -hd suffix even though its only occurring while running on iPhone 4.
You don't need the suffix of -hd for the sprites inside the hd spritesheet.
It looks like you have:
- sd-spritesheet
- image1.png
- image2.png
- etc.
- hd-spritesheet
- image1-hd.png
- image2-hd.png
- etc.
You need:
- sd-spritesheet
- image1.png
- image2.png
- etc.
- hd-spritesheet
- image1.png
- image2.png
- etc.