工作我已創建爲non retina display
一個sprite sheet
及其對模擬器工作正常.. 我已經使用了代碼精靈表不是視網膜顯示
-(Void)addSprites{
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"image.plist"];
CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"image.png"];
[self addChild:spriteSheet];
// Load up the frames of our animation
NSMutableArray *walkAnimFrames = [NSMutableArray array];
for(int i = 1; i < 5; i++) {
[walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"image%d.png", i]]];
}
CCAnimation *walkAnim = [CCAnimation animationWithSpriteFrames:walkAnimFrames delay:0.20f];
// Create a sprite for our bear
background = [CCSprite spriteWithSpriteFrameName:@"image1.png"];
background.position = ccp(280, 175);
self.walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:walkAnim]];
[spriteSheet addChild:background];
}
-(void)startAnimation{
[background runAction:_walkAction];
}
以及用於設備我已經建立sprite sheet with retina image with double size and image named like [email protected]
the created plist
is [email protected]
and image file is [email protected]
我的意思是有4個文件
非視網膜顯示。
1)imagefile.png(sprite sheet)
2)myPlist.plist
爲Retina顯示。
1)[email protected](sprite sheet)
每個圖像plist中關鍵名也像[email protected]
但上面的代碼不工作的此代碼。我做錯了什麼或缺少什麼? 設備上我的應用程序崩潰,錯誤消息
CCSpriteFrameCache: Frame 'image1.png' not found
2013-05-03 16:19:49.764 *** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
,但上面的代碼是working fine on simulator
我們需要。寫同樣的代碼兩次? – KsK 2013-05-06 04:12:23
此代碼也顯示模擬器上的高清圖像 – KsK 2013-05-06 04:26:59