我使用Zwoptex Flash版本生成:
我查过文件了,一切似乎都还好。
在我的游戏中,我首先将.plist文件添加到缓存中:
[[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:@"ParticleAnimations.plist"];然后我创建了我的CCSpriteBatchNode:
spriteBatch = [CCSpriteBatchNode batchNodeWithFile:@"ParticleAnimations.png"];
[self addChild:spriteBatch z:0];最后,使用在纹理中找到的图像的文件名创建我的CCSprite:
CCSprite *particle = [CCSprite spriteWithSpriteFrameName:@"Particle1.png"];
[spriteBatch addChild:particle z:0];现在,我在模拟器(iPhone)上运行这个程序,它运行得很好。然后,我更改硬件选项并将其设置为"iPhone (视网膜)“,这将在960x640屏幕上转换模拟器。但后来我的麻雀坠毁了。在日志中,下面是这些条目:
cocos2d: CCSpriteFrameCache:尝试使用文件“ParticleAnimations.png”作为纹理 cocos2d: CCSpriteFrameCache: Frame‘cocos2d 1.png’未找到
我不太明白。首先,为什么它使用ParticleAnimations.png而不是粒子动画-hd.png,因为它是在Retina显示模式?当然,为什么它要寻找的是刨花板1.ng而不是Parchine1hd.png?
发布于 2011-08-24 13:20:55
首先,请您考虑取消将这些行注释到appdelegate中:
// Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
if( ! [director enableRetinaDisplay:YES] )
CCLOG(@"Retina Display Not supported");它将使Cocos2d能够使用-hd文件。
然后,您的sprite名称必须与spritesheets中的名称完全相同。只有plist和纹理文件必须有"-hd“后缀。例如,如果将名为toto.png、titi.png、tata.png的spritesheets命名为mysp,则应该如下所示:
// Normal
- mysp.png
- mysp.plist
|- toto.png
|- titi.png
|- tata.png
// Retina
- mysp-hd.png
- mysp-hd.plist
|- toto.png
|- titi.png
|- tata.png有关更多信息,请参阅此处的正式文档:RetinaDisplay in cocos2d
我希望它能帮到你!
https://stackoverflow.com/questions/7170313
复制相似问题