diff --git a/README.md b/README.md index 34eaf69e..7f6628d2 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏! HTML5魔塔样板V2.3.3 * [x] 将怪物特殊属性定义和伤害计算函数移动到脚本编辑中 +* [x] 地图编辑器可以使用矩形方式绘制地图 +* [x] 瞬间移动可以指定存在事件的点(如怪物、门、楼梯等) * [x] 事件:画面震动 * [x] 事件:更新怪物数据 * [x] 移动事件和跳跃事件增加“不消失”选项 diff --git a/editor.html b/editor.html index 20d3a0cf..198bbaa7 100644 --- a/editor.html +++ b/editor.html @@ -236,9 +236,11 @@ -
+ + 画线 画矩形 +


diff --git a/libs/control.js b/libs/control.js index f9048919..e1ca95d2 100644 --- a/libs/control.js +++ b/libs/control.js @@ -393,6 +393,20 @@ control.prototype.moveDirectly = function (destX, destY) { return false; } +////// 尝试瞬间移动 ////// +control.prototype.tryMoveDirectly = function (destX, destY) { + var testMove = function (dx, dy, dir) { + if (dx<0 || dx>12 || dy<0 || dy>12) return false; + if (core.control.moveDirectly(dx, dy)) { + if (core.isset(dir)) core.moveHero(dir, function() {}); + return true; + } + return false; + } + return !(!testMove(destX,destY) && !testMove(destX-1, destY, "right") && !testMove(destX,destY-1,"down") + && !testMove(destX,destY+1,"up") && !testMove(destX+1,destY,"left")); +} + ////// 设置自动寻路路线 ////// control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) { if (!core.status.played || core.status.lockControl) { @@ -406,7 +420,7 @@ control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) { core.status.automaticRoute.moveDirectly = true; setTimeout(function () { if (core.status.automaticRoute.moveDirectly && core.status.heroMoving==0) { - core.control.moveDirectly(destX, destY); + core.control.tryMoveDirectly(destX, destY); } core.status.automaticRoute.moveDirectly = false; }, 100); @@ -431,7 +445,7 @@ control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) { // 单击瞬间移动 if (core.status.automaticRoute.clickMoveDirectly && core.status.heroStop) { - if (core.control.moveDirectly(destX, destY)) + if (core.control.tryMoveDirectly(destX, destY)) return; } @@ -1841,7 +1855,7 @@ control.prototype.replay = function () { core.useItem(itemId, function () { core.replay(); }); - }, 750 / core.status.replay.speed); + }, 750 / Math.max(1, core.status.replay.speed)); } return; } @@ -1861,7 +1875,7 @@ control.prototype.replay = function () { core.changeFloor(floorId, stair, null, null, function () { core.replay(); }); - }, 750 / core.status.replay.speed); + }, 750 / Math.max(1, core.status.replay.speed)); return; } } @@ -1894,7 +1908,7 @@ control.prototype.replay = function () { core.status.event.selection = parseInt(selections.shift()); core.events.openShop(shopId, false); - }, 750 / core.status.replay.speed); + }, 750 / Math.max(1, core.status.replay.speed)); return; } } @@ -1927,7 +1941,7 @@ control.prototype.replay = function () { if (core.control.moveDirectly(x,y)) { setTimeout(function () { core.replay(); - }, 750 / core.status.replay.speed); + }, 750 / Math.max(1, core.status.replay.speed)); return; } } diff --git a/libs/events.js b/libs/events.js index 45df159c..e0de00a3 100644 --- a/libs/events.js +++ b/libs/events.js @@ -744,7 +744,7 @@ events.prototype.doAction = function() { core.status.route.push("choices:"+index); core.events.insertAction(data.choices[index].action); core.events.doAction(); - }, 750 / core.status.replay.speed) + }, 750 / Math.max(1, core.status.replay.speed)) } else { core.stopReplay(); diff --git a/更新说明.txt b/更新说明.txt index c795932a..b87b73da 100644 --- a/更新说明.txt +++ b/更新说明.txt @@ -1,6 +1,8 @@ HTML5魔塔样板V2.3.3 将怪物特殊属性定义和伤害计算函数移动到脚本编辑中 +地图编辑器可以使用矩形方式绘制地图 +瞬间移动可以指定存在事件的点(如怪物、门、楼梯等) 事件:画面震动 事件:更新怪物数据 移动事件和跳跃事件增加“不消失”选项