From 7b27d7aa9a98f1e368d0b10929e50757660d3779 Mon Sep 17 00:00:00 2001 From: Wickedness Date: Wed, 1 Jul 2026 03:11:59 +0900 Subject: [PATCH] Recenter camera after enemy turn --- src/game/scenes/BattleScene.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/game/scenes/BattleScene.ts b/src/game/scenes/BattleScene.ts index 18bfef4..ee2d722 100644 --- a/src/game/scenes/BattleScene.ts +++ b/src/game/scenes/BattleScene.ts @@ -3407,6 +3407,15 @@ export class BattleScene extends Phaser.Scene { this.setCameraTilePosition(x - Math.floor(this.layout.visibleColumns / 2), y - Math.floor(this.layout.visibleRows / 2)); } + private centerCameraOnAllyLine() { + const focusUnit = + battleUnits.find((unit) => unit.id === 'liu-bei' && unit.hp > 0) ?? + battleUnits.find((unit) => unit.faction === 'ally' && unit.hp > 0); + if (focusUnit) { + this.centerCameraOnTile(focusUnit.x, focusUnit.y); + } + } + private setCameraTilePosition(x: number, y: number, refresh = true) { const nextX = Phaser.Math.Clamp(Math.round(x), 0, this.maxCameraTileX()); const nextY = Phaser.Math.Clamp(Math.round(y), 0, this.maxCameraTileY()); @@ -8928,6 +8937,7 @@ export class BattleScene extends Phaser.Scene { this.updateTurnText(); this.updateObjectiveTracker(); this.checkBattleEvents(); + this.centerCameraOnAllyLine(); this.renderRosterPanel('ally', [`${this.turnNumber}턴 아군 차례입니다.`, recoveryMessage, '행동할 장수를 선택하세요.'].filter(Boolean).join('\n')); }