From 8f331f13feeff576c36b1c0afd398a261ee3fb43 Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 20 Aug 2018 11:09:02 -0300 Subject: Camera tweaks --- index.js | 12 ++++++++---- 1 file 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 } } } -- cgit 1.3.0-6-gf8a5