From fb7b10b7e13c4fce70bcca9fa3d6651c3e4b6d26 Mon Sep 17 00:00:00 2001 From: panw Date: Mon, 16 Mar 2026 16:08:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(hero):=20=E9=98=B2=E6=AD=A2=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=BB=84=E4=BB=B6=E5=9C=A8=E7=89=B9=E5=AE=9A=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E5=8F=8D=E5=90=91=E7=A7=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在计算新位置后添加方向检查,确保英雄不会朝与输入方向相反的方向移动,避免可能的卡顿或位置异常。 --- assets/script/game/hero/MoveComp.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/assets/script/game/hero/MoveComp.ts b/assets/script/game/hero/MoveComp.ts index b3d92e5d..b43622e1 100644 --- a/assets/script/game/hero/MoveComp.ts +++ b/assets/script/game/hero/MoveComp.ts @@ -221,6 +221,11 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate newX = direction > 0 ? Math.min(newX, stopAtX) : Math.max(newX, stopAtX); } newX = this.clampXByAllies(view.ent, model.fac, move.baseY, currentX, newX, direction); + if (direction > 0) { + newX = Math.max(currentX, newX); + } else { + newX = Math.min(currentX, newX); + } if (Math.abs(newX - currentX) < 0.01) { view.status_change("idle"); return;