当前位置: 首页>>代码示例>>C++>>正文


C++ CCScaleBy::copy方法代码示例

本文整理汇总了C++中CCScaleBy::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ CCScaleBy::copy方法的具体用法?C++ CCScaleBy::copy怎么用?C++ CCScaleBy::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCScaleBy的用法示例。


在下文中一共展示了CCScaleBy::copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: spark

// 闪光动画
void Effect::spark(CCPoint pos, CCNode *parent, float scale, float duration)
{
    // spark 精灵
    CCSprite *one = CCSprite::create(s_explode1);
    CCSprite *two = CCSprite::create(s_explode2);
    CCSprite *three = CCSprite::create(s_explode3);
    
    // 混合模式
    ccBlendFunc cb = { GL_SRC_ALPHA, GL_ONE };
    one->setBlendFunc(cb);
    two->setBlendFunc(cb);
    three->setBlendFunc(cb);
    
    one->setPosition(pos);
    two->setPosition(pos);
    three->setPosition(pos);
    
    parent->addChild(one);
    parent->addChild(two);
    parent->addChild(three);
    
    one->setScale(scale);
    two->setScale(scale);
    three->setScale(scale);
    
    three->setRotation(CCRANDOM_0_1() * 360);
    
    CCRotateBy *left = CCRotateBy::create(duration, -45);
    CCRotateBy *right = CCRotateBy::create(duration, 45);
    CCScaleBy *scaleBy = CCScaleBy::create(duration, 3);
    CCFadeOut *fadeOut = CCFadeOut::create(duration);
    

    //JS写这个地方真是爽,这里却要写3个回调和3个动作
    CCCallFuncN *removeOne =  CCCallFuncN::create(this, callfuncN_selector(Effect::killSprite));
    CCCallFuncN *removeTwo =  CCCallFuncN::create(this, callfuncN_selector(Effect::killSprite));
    CCCallFuncN *removeThree =  CCCallFuncN::create(this, callfuncN_selector(Effect::killSprite));
    CCAction *seqOne = CCSequence::create(fadeOut, removeOne, NULL);
    CCAction *seqTwo = CCSequence::create((CCFadeOut*)fadeOut->copy(), removeTwo, NULL);
    CCAction *seqThree = CCSequence::create((CCFadeOut*)fadeOut->copy(), removeThree, NULL);
    
    one->runAction(left);
    two->runAction(right);
    
    one->runAction(scaleBy);
    two->runAction((CCScaleBy*)scaleBy->copy());
    three->runAction((CCScaleBy*)scaleBy->copy());
    
    one->runAction(seqOne);
    two->runAction(seqTwo);
    three->runAction(seqThree);
    
    
}
开发者ID:SongCF,项目名称:game-MoonWarriors,代码行数:55,代码来源:Effect.cpp


注:本文中的CCScaleBy::copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。