This commit is contained in:
ckcz123 2018-07-22 13:59:08 +08:00
parent 8908453be2
commit f5ca89e27a
5 changed files with 28 additions and 8 deletions

View File

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

View File

@ -236,9 +236,11 @@
<option value="tower">全塔属性</option> <option value="tower">全塔属性</option>
<option value="functions">脚本编辑</option> <option value="functions">脚本编辑</option>
<option value="appendpic">追加素材</option> <option value="appendpic">追加素材</option>
</select><br> </select>
<span style="font-size: 12px; margin-left: 10px">
<input type="radio" id="brushMod" name="brushMod" value="line" checked="checked" />画线 <input type="radio" id="brushMod" name="brushMod" value="line" checked="checked" />画线
<input type="radio" id="brushMod2" name="brushMod" value="rectangle" />画矩形 <input type="radio" id="brushMod2" name="brushMod" value="rectangle" />画矩形
</span>
<br><br><br> <br><br><br>
<select id="selectFloor"></select> <select id="selectFloor"></select>
<input type="button" value="保存地图" id='saveFloor'/> <input type="button" value="保存地图" id='saveFloor'/>

View File

@ -393,6 +393,20 @@ control.prototype.moveDirectly = function (destX, destY) {
return false; 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) { control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
if (!core.status.played || core.status.lockControl) { if (!core.status.played || core.status.lockControl) {
@ -406,7 +420,7 @@ control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
core.status.automaticRoute.moveDirectly = true; core.status.automaticRoute.moveDirectly = true;
setTimeout(function () { setTimeout(function () {
if (core.status.automaticRoute.moveDirectly && core.status.heroMoving==0) { if (core.status.automaticRoute.moveDirectly && core.status.heroMoving==0) {
core.control.moveDirectly(destX, destY); core.control.tryMoveDirectly(destX, destY);
} }
core.status.automaticRoute.moveDirectly = false; core.status.automaticRoute.moveDirectly = false;
}, 100); }, 100);
@ -431,7 +445,7 @@ control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
// 单击瞬间移动 // 单击瞬间移动
if (core.status.automaticRoute.clickMoveDirectly && core.status.heroStop) { if (core.status.automaticRoute.clickMoveDirectly && core.status.heroStop) {
if (core.control.moveDirectly(destX, destY)) if (core.control.tryMoveDirectly(destX, destY))
return; return;
} }
@ -1841,7 +1855,7 @@ control.prototype.replay = function () {
core.useItem(itemId, function () { core.useItem(itemId, function () {
core.replay(); core.replay();
}); });
}, 750 / core.status.replay.speed); }, 750 / Math.max(1, core.status.replay.speed));
} }
return; return;
} }
@ -1861,7 +1875,7 @@ control.prototype.replay = function () {
core.changeFloor(floorId, stair, null, null, function () { core.changeFloor(floorId, stair, null, null, function () {
core.replay(); core.replay();
}); });
}, 750 / core.status.replay.speed); }, 750 / Math.max(1, core.status.replay.speed));
return; return;
} }
} }
@ -1894,7 +1908,7 @@ control.prototype.replay = function () {
core.status.event.selection = parseInt(selections.shift()); core.status.event.selection = parseInt(selections.shift());
core.events.openShop(shopId, false); core.events.openShop(shopId, false);
}, 750 / core.status.replay.speed); }, 750 / Math.max(1, core.status.replay.speed));
return; return;
} }
} }
@ -1927,7 +1941,7 @@ control.prototype.replay = function () {
if (core.control.moveDirectly(x,y)) { if (core.control.moveDirectly(x,y)) {
setTimeout(function () { setTimeout(function () {
core.replay(); core.replay();
}, 750 / core.status.replay.speed); }, 750 / Math.max(1, core.status.replay.speed));
return; return;
} }
} }

View File

@ -744,7 +744,7 @@ events.prototype.doAction = function() {
core.status.route.push("choices:"+index); core.status.route.push("choices:"+index);
core.events.insertAction(data.choices[index].action); core.events.insertAction(data.choices[index].action);
core.events.doAction(); core.events.doAction();
}, 750 / core.status.replay.speed) }, 750 / Math.max(1, core.status.replay.speed))
} }
else { else {
core.stopReplay(); core.stopReplay();

View File

@ -1,6 +1,8 @@
HTML5魔塔样板V2.3.3 HTML5魔塔样板V2.3.3
将怪物特殊属性定义和伤害计算函数移动到脚本编辑中 将怪物特殊属性定义和伤害计算函数移动到脚本编辑中
地图编辑器可以使用矩形方式绘制地图
瞬间移动可以指定存在事件的点(如怪物、门、楼梯等)
事件:画面震动 事件:画面震动
事件:更新怪物数据 事件:更新怪物数据
移动事件和跳跃事件增加“不消失”选项 移动事件和跳跃事件增加“不消失”选项