drawBlock outside

This commit is contained in:
oc 2019-02-03 23:19:54 +08:00
parent 8d7365b683
commit c5fb825b87
3 changed files with 15 additions and 4 deletions

View File

View File

@ -72,6 +72,12 @@ control.prototype.setRequestAnimationFrame = function () {
// Global Autotile Animate
core.status.autotileAnimateObjs.blocks.forEach(function (block) {
// ------ 界面外的动画不绘制
if (block.x * 32 < core.bigmap.offsetX - 64 || block.x * 32 > core.bigmap.offsetX + 416 + 32
|| block.y * 32 < core.bigmap.offsetY - 64 || block.y * 32 > core.bigmap.offsetY + 416 + 32 + 16) {
return;
}
var cv = core.isset(block.name)?core.canvas[block.name]:core.canvas.event;
cv.clearRect(block.x * 32, block.y * 32, 32, 32);
if (core.isset(block.name)) {

View File

@ -364,16 +364,21 @@ maps.prototype.drawBlock = function (block, animate, dx, dy) {
// none空地
if (block.event.id=='none') return;
var cls = block.event.cls;
dx = dx || 0;
dy = dy || 0;
// --- 在界面外的动画不绘制
if ((animate||0)>1 && (block.event.animate||0)>1 &&
(block.x * 32 + dx < core.bigmap.offsetX - 64 || block.x * 32 + dx > core.bigmap.offsetX + 416 + 32
|| block.y * 32 + dy < core.bigmap.offsetY - 64 || block.y * 32 + dy > core.bigmap.offsetY + 416 + 32 + 16)) {
return;
}
var blockInfo = this.__getBlockInfo(block);
if (blockInfo == null) return;
var image = blockInfo.image, x = blockInfo.bx, y = blockInfo.by, height = blockInfo.height;
if (!blockInfo.isTileset) x = (animate||0)%(block.event.animate||1);
dx = dx || 0;
dy = dy || 0;
if (core.isset(block.name)) {
core.clearMap(block.name, block.x * 32, block.y * 32, 32, 32);
if (block.name == 'bg') {