버튼에 "언론은"나는 애니메이션을 실행 CCAnimate 랙이 처음에만
//create sprite
animatedSprite = [[CCSprite alloc] initWithFile:@"transparentPixel.png" rect:CGRectMake(0, 0, 218, 218)];
SET_POS(animatedSprite, 167, 51);
[self addChild:animatedSprite z:5000];
//animate sprite
[animatedSprite runAction:[CCAnimate actionWithAnimation:[[CCAnimationCache sharedAnimationCache] animationByName:@"skill1use"]]];
//run cleanup fnktion
[animatedSprite performSelector:@selector(removeFromParentAndCleanup:) withObject:[NSNumber numberWithBool:YES] afterDelay:3];
[animatedSprite release];
이전에 내가 가진 프레임을로드 :
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:[CCDirector sharedDirector].contentScaleFactor>[email protected]"[email protected]":@"skill_01_ani.plist"];
[[CCAnimationCache sharedAnimationCache] addAnimation:[CCAnimation animationWithSpriteSequence:[CCDirector sharedDirector].contentScaleFactor>[email protected]"skill_01_ani%[email protected]":@"skill_01_ani%04d.png" numFrames:34 delay:1/24.0] name:@"skill1use"];
그러나, 애니메이션 후 훨씬 부드럽게 실행 처음으로 처음 시작할 때까지 시간이 걸립니다. 애니메이션을 잘못 미리로드하고 있습니까? 처음으로 애니메이션을 원활하게 실행할 수있는 방법이 있습니까?
UPDATE
것은 나는 그것을 빨리 처음 실행되는 미리보기에서 다음과 같은 설정 한 경우 :
CCSprite *animatedSprite = [[CCSprite alloc] initWithFile:@"transparentPixel.png" rect:CGRectMake(0, 0, 218, 218)];
[self addChild:animatedSprite z:5000];
[animatedSprite runAction:[CCAnimate actionWithAnimation:[[CCAnimationCache sharedAnimationCache] animationByName:@"skill1use"]]];
[animatedSprite performSelector:@selector(removeFromParentAndCleanup:) withObject:[NSNumber numberWithBool:YES] afterDelay:3];
[animatedSprite release];
을이 애니메이션을 실행하는 것과 동일하기 때문에. 그러나 이것은 실제로 애니메이션 (addChild 및 모든 것)을 표시하는 경우에만 작동합니다.
@ 2x 파일로드를 결정하는 contentScaleFactor를 사용할 때 나는 움찔합니다. 왜 cocos2d의 네이티브 -hd 파일 확장자를 사용하지 않으시겠습니까? – LearnCocos2D
내가 가진 모든 파일의 이름을 바꾸는 것보다 쉽습니다;) – Daniel
정말 쉽지 않다고 생각하지 마십시오. 모든 파일을 zwoptex 또는 texturepacker로 압축하면 모든 아트에 대해 몇 개의 아틀라스 만 사용하게됩니다. – Morion