精灵切割
来源:互联网 发布:fx网络什么意思 编辑:程序博客网 时间:2024/05/01 11:45
//图片路径
_currentUrl : null
/*
* 初始化
*/
_init:function(){
// 随机精灵
this._currentUrl = "res/"+parseInt(1 + Math.random()*13)+".png";
},
_buildShred: function(){
//将一张图片添加到缓存
var texture = cc.textureCache.addImage(this._currentUrl);
var textureBasePoint = cc.p(0,texture.height);
//每块碎片的宽度
var wid = texture.width/LEVEL;
//每块碎片的高度
var hei= texture.height/LEVEL;
//防止移位
wid = wid.toFixed(5)-0.00001;
hei = hei.toFixed(5)-0.00001;
//按顺序切割
for(var i=0;i<LEVEL;i++){
for (var j = 0; j<LEVEL ; j++){
//保存碎片
this._sp = new Cell(texture,cc.rect(i*wid,j*hei,wid,hei), num);
//设定碎片锚点
this._sp.setAnchorPoint(0,1);
this._sp.setPosition(this.A.x+i*wid ,100+texture.height - j*hei );
this._picPanel.addChild(this._sp);
this._shredArr.push(this._sp);
}
}
},
- 精灵切割
- 精灵切割
- unity 精灵切割
- Unity教程之-Unity3d中Sprite(精灵)的切割和导出
- 精灵
- 精灵
- 精灵
- 精灵
- Unity 2D Sprite 一张精灵图片【自动切割(Automatic )】成【不规则的许多个小图片】的步骤
- 线段切割&&矩形切割
- 文件切割
- 字符串切割
- 字符串切割
- 对象切割
- 切割文本文件
- 切割汉字
- 切割图片
- 日志切割
- java垃圾收集机制(GC)
- unity克隆抛物线型金币的方法
- echarts关系图 unicode编码 phpsql 2016.06.21回顾
- 常用URL
- Unity 激活或关闭选中物体快捷键
- 精灵切割
- Spring 3.X 中各JAR包的用途说明
- 在线手册
- json异常com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type #657
- 小白进阶之期望为线性时间的选择算法
- oracle删除不了用户,提示“无法删除当前已连接的用户”
- Unity5的关卡切换
- iOS通过html模版实现富文本编辑
- SQL中 and or优先级问题