egret游戏开发笔记(添加特效和释放特效)
发布时间
阅读量:
阅读量
设置当前特效部分为效果管理器添加的效果,默认名称"eff/962";该效果被赋值到当前组别,并根据图像宽度的一半减十一、高度减 thirty-four的位置初始化,默认缩放比例为一个、尺寸各 five hundred 像素、透明度关闭。
/** 添加一个特效
- @KEY 例如:eff/zy_3
- @parent 容器
- @x @y 位置
- scale 放大倍數
- @interval 特效单次播放时间(毫秒)
- @time 特效生命时长(毫秒),如果为-1则认为无限时(需要手动移除!)
- @repeat 是否重复播放
- @act 资源中的动作名字,一般用1,具体可以到 resource/model/eff/文件夹下面的JSON文件查看动作名
*/
public static addEff(key: string, parent: egret.DisplayObjectContainer, x = 0, y = 0,scale:number = 1, interval = 1000, time: number = -1, repeat: boolean = true, act = "1"): Part {
var ret = this.instance.addEff1(key, parent, x, y,scale, interval, time, repeat, act);
return ret;
}
当设置为-1时必须手动去释放特效资源(例如,在有多个items时需依次循环释放)
公共方法 named removeJy is defined as {
for each index i starting from 0 up to the length of variable this.roleGrids, do {
调用变量 roleGrids at index i's method to perform cleanup.
}
}
Variable named roleGrids holds an array of items.
public void removeJYeff(){}
if (this.EffPart != null) {
EffectMgr.getInstance().removeEff(this.EffPart);
this.EffPart = null;
}
全部评论 (0)
还没有任何评论哟~
