对比kCCPositionTypeFree和kCCPositionTypeRelative两种粒子移动类型

CCParticleSystem* particleSystemFree = CCParticleSun::create();

        //设置贴图

        particleSystemFree->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));

        //设置自动释放 

        particleSystemFree->setAutoRemoveOnFinish(true);

        //设置类型移动类型kCCPositionTypeFree-----随着layer的移动会有拖尾的效果

        particleSystemFree->setPositionType(kCCPositionTypeFree);

        particleSystemFree->setPosition(ccp(90,160));

        addChild(particleSystemFree);



        CCParticleSystem* particleSystemRe1 = CCParticleSun::create();

        particleSystemRe1->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));

        //设置移动类型kCCPositionTypeRelative----随着layer的移动并没有什么变化

        particleSystemRe1->setPositionType(kCCPositionTypeRelative);

        particleSystemRe1->setPosition(ccp(200,160));

        addChild(particleSystemRe1);



        //让当前layer来回移动,观察两个移动模式不同的粒子特效

        CCFiniteTimeAction* move = CCMoveBy::create(3,ccp(290,0));

        CCFiniteTimeAction* back = move->reverse();

        this->runAction(CCSequence::create(move,back,NULL));

对比kCCPositionTypeFree和kCCPositionTypeRelative两种粒子移动类型

你可能感兴趣的:(position)