1

我正在尝试创建一个上面有许多精灵的新类,它们一个接一个地执行一些动作,并在屏幕上做一些其他很酷的事情。

整个“表演”将在某个课程中,当我需要时出现在屏幕上。

在我的主类Maina 上CCScene,我希望能够随时调用该动画类,并将其添加到我的主屏幕并执行其“显示”。

some class :
 //FADE ACTIONS
    fadeInAction=[CCFadeIn actionWithDuration:0.5];
    fadeOutAction=[CCFadeOut actionWithDuration:0.5];
    fadeOutFastAction=[CCFadeOut actionWithDuration:0.1];


    //circle animation parts
    for (int i=0;i<12;i++)
    {
        circlePartsArray[i]=[CCSprite spriteWithFile:[NSString stringWithFormat:@"c%d.png",i+1]];
        circlePartsArray[i].position=ccp(winSize.width/2,winSize.height/2);
        [self addChild:circlePartsArray[i]];

    }

然后从我的主要课程中,我想在我的屏幕上看到所有的表现someClass——添加的精灵,而不是它们会褪色等。

我将如何定义该类,并将其添加到我的主场景中?

4

1 回答 1

0

Extend the CCNode class. Overwrite the CCNode Class' onEnter method, which you will use to create and add the child sprites, and start the animation. This way whenever you add the Node to your scene, it will begin the animation (probably using action sequences). Your animation action sequences should end with a CCCallBlock action, which you will use to clean up and remove the Node from its parent.

于 2013-01-29T17:12:47.060 回答