title: Sprite Frame Animation Cocos2d 3.0
body: <p>I've been trying to make an animated sprite, they're are a lot of tutorials but they're all for Cocos2d 2.x. My sprite sheet is named flappbird.png and the .plist is named flappbird.plist</p>
  
  <p>I have this code but every time i start the scene it just crashes, this is in my <strong>init</strong> method</p>
  
  <pre><code>// -----------------------------------------------------------------------
  
  _player = [CCSprite spriteWithImageNamed:@"monster1.png"]; // comes from your .plist file
  _player.position  = ccp(self.contentSize.width/28,self.contentSize.height/2);
  _player.physicsBody = [CCPhysicsBody bodyWithRect:(CGRect){CGPointZero, _player.contentSize} cornerRadius:0]; // 1
  _player.physicsBody.collisionGroup = @"playerGroup";
  _player.physicsBody.type = CCPhysicsBodyTypeStatic;
  CCSpriteBatchNode *batchNode = [CCSpriteBatchNode batchNodeWithFile:@"monster1.png"];
  [batchNode addChild:_player];
  [self addChild:batchNode];
  
  NSMutableArray *animFrames = [NSMutableArray array];
  for(int i = 1; i &lt; 5; i++)
  {
      CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"flapbird%d.png",i]];
      [animFrames addObject:frame];
  }
  
  CCAnimation *animation = [CCAnimation animationWithSpriteFrames:animFrames delay:0.2f];
  [_player runAction:[CCActionRepeatForever actionWithAction:[CCActionAnimate actionWithAnimation:animation]]];
  
  [_physicsWorld addChild:_player];
  
  // -----------------------------------------------------------------------
  </code></pre>