From 2b950239837d83ec3847f9dfb7356559a47cb68e Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 13 Aug 2021 15:07:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9E=AC=E7=A7=BB=E4=B8=8D=E8=81=9A=E9=9B=86?= =?UTF-8?q?=E8=B7=9F=E9=9A=8F=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/control.js | 25 +++++++++++++++++++++++++ project/functions.js | 5 +++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/libs/control.js b/libs/control.js index 5dbb4336..d86284d5 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1107,6 +1107,31 @@ control.prototype.updateFollowers = function () { }) } +////// 瞬移更新跟随者坐标 ////// +control.prototype._moveDirectyFollowers = function (x, y) { + var route = core.automaticRoute(x, y); + if (route.length == 0) route = [{x: x, y: y, direction: core.getHeroLoc('direction')}]; + + var nowx = x, nowy = y; + for (var i = 0; i < core.status.hero.followers.length; ++i) { + var t = core.status.hero.followers[i]; + var index = route.length - i - 2; + if (index < 0) index = 0; + t.stop = true; + t.x = route[index].x; + t.y = route[index].y; + t.direction = route[index].direction; + var dx = nowx - t.x, dy = nowy - t.y; + for (var dir in core.utils.scan2) { + if (core.utils.scan2[dir].x == dx && core.utils.scan2[dir].y == dy) { + t.stop = false; + t.direction = dir; + } + } + nowx = t.x; nowy = t.y; + } +} + ////// 更新领域、夹击、阻击的伤害地图 ////// control.prototype.updateCheckBlock = function(floorId) { return this.controldata.updateCheckBlock(floorId); diff --git a/project/functions.js b/project/functions.js index 49971abb..09cc7ab3 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1539,8 +1539,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = if (['left', 'right', 'up', 'down'].indexOf(lastDirection) >= 0) core.setHeroLoc('direction', lastDirection); // 设置坐标,并绘制 - core.setHeroLoc('x', x); - core.setHeroLoc('y', y); + core.control._moveDirectyFollowers(x, y); + core.status.hero.loc.x = x; + core.status.hero.loc.y = y; core.drawHero(); // 记录录像 core.status.route.push("move:" + x + ":" + y);