1
저는 cocos2d 및 o.c 프로그래밍이 정말 새로워졌습니다. 스프라이트 애니메이션이 어떻게 작동하는지 알아 내려고 노력했습니다. 최신 업데이트로 인해 더 이상 작동하지 않는 오래된 코드가 많이 생깁니다.cocos2d 애니메이션이 계속 충돌합니다.
내가
다음 (내가 애니메이션을 적용 할 3 개 스프라이트와 spriteheet가) 어떻게 든
이 내 init 메소드에 충돌 계속이
[[CCSpriteFrameCache sharedSpriteFrameCache ] addSpriteFramesWithFile:@"eno_glasses.plist" ];
CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"eno_glasses.png"];
[self addChild:spriteSheet];
_body = [CCSprite spriteWithSpriteFrameName: [NSString stringWithFormat:@"eno_glasses02.png"]];
[spriteSheet addChild:_body];
_body.position = CGPointMake(screenSize.width/2, screenSize.height/2);
NSMutableArray *animFrames = [NSMutableArray array];
for(int i = 1; i < 3; i++) {
CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"eno_glasses0%d.png",i]];
[animFrames addObject:frame];
}
CCAnimation *animation = [CCAnimation animationWithFrames:animFrames delay:0.03f];
CCAnimate* anime = [CCAnimate actionWithAnimation:animation];
[self runAction:anime];
나는 이미지 수있어 이 작품 (그리고 plist에서 이미지를 얻을 수 있기 때문에 찾을 수 01,02,03)
나는 어딘가에 잊지 오전?
[[CCSpriteFrameCache sharedSpriteFrameCache ] addSpriteFramesWithFile:@"eno_glasses.plist" ];
CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"eno_glasses.png"];
[self addChild:spriteSheet];
_body = [CCSprite spriteWithSpriteFrameName: [NSString stringWithFormat:@"eno_glasses02.png"]];
[spriteSheet addChild:_body];
_body.position = CGPointMake(screenSize.width/2, screenSize.height/2);
어떻게 그 스프라이트를 한 번 애니메이션화 한 다음 몇 초 정도 기다렸다가 다시 애니메이트합니까? 진드기 생성자를 사용 하시겠습니까? – renevdkooi