• 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);
  • 相关阅读:
    ApiController实现自定义身份认证
    类型参数的约束(C# 编程指南)
    C# 交集、并集、差集
    Winform多线程使用委托操作控件
    ShowWindowAsync系统方法cmdShow参数值含义
    xtraTabbedMdiManager控件切换时控件不更新的问题
    ApiController默认使用Json格式
    css单位介绍em ex ch rem vw vh vm cm mm in pt pc px
    JavaScript 函数大全
    css3动画整理
  • 原文地址:https://www.cnblogs.com/yufenghou/p/4157329.html
Copyright © 2020-2023  润新知