2012-01-15 3 views

답변

1

CCAnimation의 개체를 만들고 그 안에 모든 이미지 프레임을 추가 한 다음 CCAnimate 개체를 만들어 CCAnimation 개체를 추가해야합니다. 그런 다음 주 객체의 runAction에서 CCAnimate 객체를 사용하십시오.

+0

문제가 있다는 것입니다 ... 그래서 이것은 당신이 ... 당신을 위해 모든 도움이되기를 바랍니다적인 Cocos2D에서 애니메이션을 할 수있는 방법이 시도 다이아몬드에 대한 내 애니메이션이 코드를 사용 나는 내 자신의 애니메이션을 crete하는 데 사용할 수있는 예제를 찾을 수 없습니다. 어떤 소프트웨어가 스프라이트와 plist 파일로 PNG 이미지를 만들 수 있습니까? –

+0

다음 링크를 확인할 수 있습니다. http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d. 그것은 obj-c에 있지만 자바로 이식하기가 어렵지 않을 것이다. – Ashishail

+0

나는이 튜토리얼을 몇 시간 동안 보냈지 만, 여기에 사용 된 프로그램은 튜토리얼과 같지 않지만 여전히 찾을 수있다. –

2

은 내가

public void openScrPpr(float duration, CCSprite scrPprRoller) { 

      CCAnimation scrPprAnim = CCAnimation.animation("", 2/20f); 

      for (int i = 20; i > 1; i--) { 

       if (i >= 10 && i <= 20) { 
        scrPprAnim.addFrame(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName("paperrol." + i + ".png")); 
       } else { 
        scrPprAnim.addFrame(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName("paperrol.0" + i + ".png")); 
       } 
      } 

      CCAction scrPprAction = CCAnimate.action(duration, scrPprAnim, false); 
      scrPprRoller.runAction(scrPprAction); 
관련 문제