转载地址:http://blog.csdn.net/ssihc0/article/details/6784819

   CCSpriteFrameCache *cache = [CCSpriteFrameCache sharedSpriteFrameCache];
[cache addSpriteFramesWithFile:@"t1.plist" textureFile:@"t1.png"];

CCSprite *mySprite = [CCSprite spriteWithSpriteFrameName:@"a1.png"];
mySprite.position = ccp(240,160);
[self addChild:mySprite];


NSMutableArray *climbFrames = [NSMutableArray array];
for(int i = 1; i < 7; i++) {
NSString *fn = [NSString stringWithFormat:@"a%d.png",i];
CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:fn];
[climbFrames addObject:frame];
}

CCAnimation *animateClimb = [CCAnimation animationWithFrames:climbFrames delay:0.2f];
id a1 = [CCAnimate actionWithAnimation:animateClimb restoreOriginalFrame:NO];
[mySprite runAction:a1];



相关文章:

  • 2021-08-07
  • 2022-02-18
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2022-12-23
  • 2021-04-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2021-05-03
相关资源
相似解决方案