2011-08-28 81 views
1

我跟随了很多关于如何在cocos2d中制作动画精灵的视频。但是,当代码运行时,我似乎总是通过这种方式。cocos2d sprite动画“SIGABRT”

CCSpriteBatchNode * spriteSheet = [CCSpriteBatchNode SpriteSheetWithFile:@“animbear.png”];

它说(线程1:程序接收到的信号“SIGBRT”)

林不知道你做我用尽了一切我可以请帮助?

继承人在init方法内的代码 继承人的代码部分!

// Import the interfaces 
#import "HelloWorldLayer.h" 

// HelloWorldLayer implementation 

@implementation HelloWorldLayer 
// At the top, under @implementation 

@synthesize bear = _bear; 

@synthesize moveAction = _moveAction; 

@synthesize walkAction = _walkAction; 

-(id) init { 
    if((self = [super init])) { 

     [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile: 
     @"bear.plist"];  


     CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode 
      batchNodeWithFile:@"bear.jpg"]; 
     [self addChild:spriteSheet]; 

     NSMutableArray *walkAnimFrames = [NSMutableArray array]; 
     for(int i = 1; i <= 8; ++i) { 
      [walkAnimFrames addObject: *****THIS IS WERE (PROGRAM RECEIVED SIGNAL:"SIGABRT*** 
      [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName: 
       [NSString stringWithFormat:@"bear%d.png", i]]]; 
     } 
      CCAnimation *walkAnim = [CCAnimation 
      animationWithFrames:walkAnimFrames delay:0.1f];  

      CGSize winSize = [CCDirector sharedDirector].winSize; 
      self.bear = [CCSprite spriteWithSpriteFrameName:@"bear.jpg"];   
      _bear.position = ccp(winSize.width/2, winSize.height/2); 
      self.walkAction = [CCRepeatForever actionWithAction: 
           [CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]]; 
      [_bear runAction:_walkAction]; 
      [spriteSheet addChild:_bear];   

     } 

    return self; 
} 
+0

当此崩溃,请按CMD + SHIFT + R,以及复制/控制台窗口中的内容粘贴到这个问题的PNG和plist文件之前保存图纸。 – badgerr

回答

1

您是否已将animbear.png添加到您的项目中?

+0

令人遗憾的是,由于animbear.png,我知道他在说什么教程。 –

+0

对此的回答是让出更多:) –

+1

出去?在哪里?我不喜欢你所说的这个“外面”的声音。 –

0

确保您使用发布Zwoptex