Fork me on GitHub

egret之moveclip 序列帧动画

废话不多说,直接上代码:

 private addEffect(name, x: number, y: number, act?: string) {
        let data = RES.getRes(name + "_json");
        let txtr = RES.getRes(name + "_png");
        let mcFanctory: egret.MovieClipDataFactory = new egret.MovieClipDataFactory(data, txtr);
        let mv: egret.MovieClip = new egret.MovieClip(mcFanctory.generateMovieClipData(name));
        mv.x = x;
        mv.y = y;
        let scale = this.itemImg.width / 234;
        mv.scaleX = mv.scaleY = scale;
        this.effectGroup.addChild(mv);
        mv.play(num);
        return mv;
    }

注意,用moveclip 序列帧时,如果美术给你的资源时gif,那你可能会遇到麻烦,所以建议大家使用swf格式的素材。

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