editor-tilesets:check <img>.[height/width] mod 32

This commit is contained in:
YouWei Zhao 2018-09-27 00:05:49 +08:00
parent 458e464f73
commit 8e6e301bae

View File

@ -113,6 +113,9 @@ editor.prototype.idsInit = function (maps, icons) {
var imgName = core.tilesets[i];
var img = core.material.images.tilesets[imgName];
var width = Math.floor(img.width/32), height = Math.floor(img.height/32);
if(img.width%32 || img.height%32){
alert(imgName+'的长或宽不是32的整数倍, 请修改后刷新页面')
}
for (var id=startOffset; id<startOffset+width*height;id++) {
var x = (id-startOffset)%width, y = parseInt((id-startOffset)/width);
var indexBlock = getInfoById(id);