48 in bg/fg

This commit is contained in:
oc 2019-02-20 21:30:30 +08:00
parent 15c889146d
commit f98c85442f
2 changed files with 20 additions and 19 deletions

View File

@ -797,25 +797,21 @@ editor.prototype.listen = function () {
currDrawData.info = JSON.parse(JSON.stringify(editor.info)); currDrawData.info = JSON.parse(JSON.stringify(editor.info));
reDo = null; reDo = null;
// console.log(stepPostfix); // console.log(stepPostfix);
if (editor.layerMod!='map' && editor.info.images && editor.info.images.indexOf('48')!==-1){ if(editor.brushMod==='tileset' && core.tilesets.indexOf(editor.info.images)!==-1){
printe('前景/背景不支持48的图块'); var imgWidth=~~(core.material.images.tilesets[editor.info.images].width/32);
} else { var x0=stepPostfix[0].x;
if(editor.brushMod==='tileset' && core.tilesets.indexOf(editor.info.images)!==-1){ var y0=stepPostfix[0].y;
var imgWidth=~~(core.material.images.tilesets[editor.info.images].width/32); var idnum=editor.info.idnum;
var x0=stepPostfix[0].x; for (var ii = 0; ii < stepPostfix.length; ii++){
var y0=stepPostfix[0].y; if(stepPostfix[ii].y!=y0){
var idnum=editor.info.idnum; y0++;
for (var ii = 0; ii < stepPostfix.length; ii++){ idnum+=imgWidth;
if(stepPostfix[ii].y!=y0){
y0++;
idnum+=imgWidth;
}
editor[editor.layerMod][stepPostfix[ii].y][stepPostfix[ii].x] = editor.ids[editor.indexs[idnum+stepPostfix[ii].x-x0]];
} }
} else { editor[editor.layerMod][stepPostfix[ii].y][stepPostfix[ii].x] = editor.ids[editor.indexs[idnum+stepPostfix[ii].x-x0]];
for (var ii = 0; ii < stepPostfix.length; ii++)
editor[editor.layerMod][stepPostfix[ii].y][stepPostfix[ii].x] = editor.info;
} }
} else {
for (var ii = 0; ii < stepPostfix.length; ii++)
editor[editor.layerMod][stepPostfix[ii].y][stepPostfix[ii].x] = editor.info;
} }
// console.log(editor.map); // console.log(editor.map);
editor.updateMap(); editor.updateMap();

View File

@ -432,11 +432,16 @@ maps.prototype.drawBlock = function (block, animate, dx, dy) {
if (!blockInfo.isTileset) x = (animate||0)%(block.event.animate||1); if (!blockInfo.isTileset) x = (animate||0)%(block.event.animate||1);
if (core.isset(block.name)) { if (core.isset(block.name)) {
core.clearMap(block.name, block.x * 32, block.y * 32, 32, 32); core.clearMap(block.name, block.x * 32, block.y * 32 + 32 - height, 32, height);
if (block.name == 'bg') { if (block.name == 'bg') {
if (height>32) {
core.clearMap(block.name, block.x * 32, block.y * 32 - 32, 32, 32);
core.drawImage('bg', core.material.groundCanvas.canvas, block.x * 32, block.y * 32 - 32);
}
core.drawImage('bg', core.material.groundCanvas.canvas, block.x * 32, block.y * 32); core.drawImage('bg', core.material.groundCanvas.canvas, block.x * 32, block.y * 32);
} }
core.drawImage(block.name, image, x * 32, y * 32, 32, 32, block.x * 32, block.y * 32, 32, 32); core.drawImage(block.name, image, x * 32, y * height, 32, height,
block.x * 32, block.y * 32 + 32 - height, 32, height);
return; return;
} }