开发者

cocos2d - textures are not found on the device

Here's my code with I use to create sprite thanks to cocos2d.

[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"bambusowy.plist"];
  CCSpriteSheet *teksturySheet 开发者_JAVA百科= [CCSpriteSheet spriteSheetWithFile:@"bambusowy.png"];
  [self addChild:teksturySheet];
  
  
    
   NSString * stttt = [NSString stringWithUTF8String: tex_dane[mapa1[i][0]].c_str()];
   

   CCSprite *teksturka = [CCSprite spriteWithSpriteFrameName:stttt]; 

This code works fine on the Simulator, but it crash on the device. Here are the logs:

Tue Aug 10 15:36:39 unknown menu panda[1271] : *** Assertion failure in -[CCSprite initWithTexture:rect:], /Users/.... libs/cocos2d/CCSprite.m:183

Tue unknown menu panda[1271] : *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid texture for sprite'

I guess the problem is that it cant select texture from an atlas...


I am trying to find an answer to this question as well. It seems any texture larger than 1024 x 1024 will crash on iPhone 3Gs, could that be the case for you as well? I've reduced the size of my textures and they run OK now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜