cocos2d-x 粒子移动类型

 //清晰移动类型的作用
    
    CCParticleSystem* particleSystem1 = CCParticleSun::create();
    particleSystem1->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));
    //自动释放
    particleSystem1->setAutoRemoveOnFinish(true);
    //设置移动类型:自由模式
    particleSystem1->setPositionType(kCCPositionTypeFree);
    particleSystem1->setPosition(ccp(90, 160));
    addChild(particleSystem1);
    
    
    CCParticleSystem* particleSyatem2 = CCParticleSun::create();
    particleSyatem2->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));
    //设置移动类型:相对模式
    particleSyatem2->setPositionType(kCCPositionTypeRelative);
    particleSyatem2->setPosition(ccp(200, 160));
    addChild(particleSyatem2);
    
    
    //让当前的Layer永久来回移动
    CCActionInterval* move = CCMoveBy::create(3, ccp(290, 0));
    CCActionInterval* back = move->reverse();
    this->runAction(CCRepeatForever::create(CCSequence::create(move, back, NULL)));

你可能感兴趣的:(cocos2d-x 粒子移动类型)