cocos 自定义粒子系统

    auto particleSystem = ParticleSystemQuad::createWithTotalParticles(200);    

    //设置雪花粒子纹理图片
    particleSystem->setTexture(TextureCache::getInstance()->addImage("snow.png"));    
    //设置发射粒子的持续时间-1表示永远持续
    particleSystem->setDuration(-1);
    //设置粒子的重力方向 
    particleSystem->setGravity(Point(0,-240));

    //设置角度以及偏差
    particleSystem->setAngle(90); 
    particleSystem->setAngleVar(360);

    //设置径向加速度以及偏差
    particleSystem->setRadialAccel(50);
    particleSystem->setRadialAccelVar(0);

    //设置粒子的切向加速度以及偏差
    particleSystem->setTangentialAccel(30);
    particleSystem->setTangentialAccelVar(0);

    // 设置粒子初始化位置偏差
    particleSystem->setPosVar(Point(400,0));

    //设置粒子生命期以及偏差
    particleSystem->setLife(4);
    particleSystem->setLifeVar(2);

    //设置粒子开始时候旋转角度以及偏差
    particleSystem->setStartSpin(30);
    particleSystem->setStartSpinVar(60);

    //设置结束时候的旋转角度以及偏差
    particleSystem->setEndSpin(60);
    particleSystem->setEndSpinVar(60);

    //设置开始时候的颜色以及偏差
    particleSystem->setStartColor(Color4F(1,1,1,1));
    //设置结束时候的颜色以及偏差
    particleSystem->setEndColor(Color4F(1,1,1,1));

    //设置开始时候粒子大小以及偏差
    particleSystem->setStartSize(30);
    particleSystem->setStartSizeVar(0);

    //设置粒子结束时候大小以及偏差
    particleSystem->setEndSize(20.0f);
    particleSystem->setEndSizeVar(0);

    //设置每秒钟产生粒子的数量
    particleSystem->setEmissionRate(100);

    particleSystem->setPosition(Point(visibleSize.width/2, visibleSize.height + 50));

    this->addChild(particleSystem);
原文地址:https://www.cnblogs.com/yufenghou/p/4157329.html