diff options
-rw-r--r-- | index.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/index.js b/index.js index 79d7d7f..ad0f71a 100644 --- a/index.js +++ b/index.js @@ -1270,13 +1270,17 @@ class BattleCamera extends Camera { const characters = this.battle.getAllBattleCharacters() - const leftmostX = characters.reduce((acc, c) => Math.min(acc, c.x), 0) - const rightmostX = characters.reduce((acc, c) => Math.max(acc, c.x), 0) - const distanceX = Math.abs(leftmostX - rightmostX) + const leftmostX = characters.reduce((acc, c) => Math.min(acc, c.x), characters[0].x) + const rightmostX = characters.reduce((acc, c) => Math.max(acc, c.x), characters[0].x) + // const distanceX = Math.abs(leftmostX - rightmostX) + + const topmostY = characters.reduce((acc, c) => Math.min(acc, c.y), characters[0].y) + const bottommostY = characters.reduce((acc, c) => Math.max(acc, c.y), characters[0].y) + // const distanceY = Math.abs(topmostY - bottommostY) return { x: (leftmostX + rightmostX) / 2, - y: by + y: (topmostY + bottommostY) / 2 } } } |