fix: 移动的平滑视角

This commit is contained in:
unanmed 2024-10-19 19:27:35 +08:00
parent f03eae4345
commit 5685efd4d5
2 changed files with 6 additions and 4 deletions

View File

@ -117,7 +117,6 @@ export class FloorViewport implements ILayerGroupRenderExtends {
this.group.removeTicker(this.transition, false); this.group.removeTicker(this.transition, false);
this.nx = nx; this.nx = nx;
this.ny = ny; this.ny = ny;
console.log(nx, ny);
} }
/** /**

View File

@ -486,10 +486,13 @@ export class HeroMover extends ObjectMoverBase {
await adapter.all('readyMove'); await adapter.all('readyMove');
// 这里要检查前面那一格能不能走,不能走则不触发平滑视角,以避免撞墙上视角卡住 // 这里要检查前面那一格能不能走,不能走则不触发平滑视角,以避免撞墙上视角卡住
const { x, y } = core.status.hero.loc; const { x, y } = core.status.hero.loc;
const data = this.checkCanMove(x, y, toDir(this.faceDir)); const firstDir = controller.queue.find(v => v.type === 'dir')?.value;
if (firstDir) {
const data = this.checkCanMove(x, y, toDir(firstDir as Dir));
if (data.canMove && !data.noPass) { if (data.canMove && !data.noPass) {
viewport.sync('startMove'); viewport.sync('startMove');
} }
}
adapter.sync('startAnimate'); adapter.sync('startAnimate');
} }