Fork me on GitHub

egret之粒子系统

1.添加粒子库,放在项目同级目录下(必须!!必须!!)

2.添加路径:

3.添加代码:

    private creatParticle(_pname: string, _target, _x: number, _y: number) {
        if (_target != null) {
            let texture = RES.getRes(_pname + "_png");
            let config = RES.getRes(_pname + "_json");
   
            var _particle = new particle.GravityParticleSystem(texture, config);
            _particle.touchEnabled = false;
            _target.addChild(_particle);

            _particle.x = _x;
            _particle.y = _y;
            _particle.start()
            return _particle;
        } else {
            console.log("装载容器不存在");
        }
    }

 

posted @ 2018-09-25 17:24  爱上游戏开发  阅读(1066)  评论(0编辑  收藏  举报
 >>>转载请注明出处