diff --git a/client/src/scenes/combat.cryps.js b/client/src/scenes/combat.cryps.js index 2e39dc00..d33c490d 100644 --- a/client/src/scenes/combat.cryps.js +++ b/client/src/scenes/combat.cryps.js @@ -1,12 +1,11 @@ const Phaser = require('phaser'); const genAvatar = require('./avatar'); -const StatBar = require('./elements/statbar'); +const StatBar = require('./elements/combat.statbar'); const { DELAYS, TEXT, POSITIONS: { COMBAT } } = require('./constants'); -const CRYP_MARGIN = COMBAT.height() / 4.5; -const TEXT_MARGIN = COMBAT.height() / 35; - +const CRYP_MARGIN = COMBAT.crypMargin(); +const TEXT_MARGIN = COMBAT.textMargin(); const crypAvatarText = (team, iter) => { const nameX = COMBAT.width() * team; diff --git a/client/src/scenes/combat.hitbox.js b/client/src/scenes/combat.hitbox.js index 71a309a8..1a111bf2 100644 --- a/client/src/scenes/combat.hitbox.js +++ b/client/src/scenes/combat.hitbox.js @@ -1,7 +1,7 @@ const Phaser = require('phaser'); const { POSITIONS: { COMBAT } } = require('./constants'); -const CRYP_MARGIN = COMBAT.height() / 4.5; +const CRYP_MARGIN = COMBAT.crypMargin(); const BOX_HEIGHT = CRYP_MARGIN * 0.8; const BOX_WIDTH = COMBAT.width() * 0.2; diff --git a/client/src/scenes/constants.js b/client/src/scenes/constants.js index 78e88cde..5fe1829e 100644 --- a/client/src/scenes/constants.js +++ b/client/src/scenes/constants.js @@ -33,6 +33,8 @@ const combatWidth = () => CANVAS_WIDTH; const combatHeight = () => CANVAS_HEIGHT - headerHeight(); const combatY = () => headerHeight(); const combatX = () => 0; +const combatCrypMargin = () => Math.floor((CANVAS_HEIGHT - headerHeight()) / 4.5); +const combatTextMargin = () => Math.floor((CANVAS_HEIGHT - headerHeight()) / 35); const statsWidth = () => Math.floor(CANVAS_WIDTH - menuCrypListWidth()); const statsHeight = () => CANVAS_HEIGHT - headerHeight(); @@ -107,6 +109,9 @@ module.exports = { y: combatY, width: combatWidth, height: combatHeight, + crypMargin: combatCrypMargin, + textMargin: combatTextMargin, + LOG: { x: logX, diff --git a/client/src/scenes/elements/combat.statbar.js b/client/src/scenes/elements/combat.statbar.js index 25491172..b2c2371e 100644 --- a/client/src/scenes/elements/combat.statbar.js +++ b/client/src/scenes/elements/combat.statbar.js @@ -1,8 +1,8 @@ const Phaser = require('phaser'); const { TEXT, POSITIONS: { COMBAT }, COLOURS } = require('.././constants'); -const CRYP_MARGIN = COMBAT.height() / 4.5; -const TEXT_MARGIN = COMBAT.height() / 35; +const CRYP_MARGIN = COMBAT.crypMargin(); +const TEXT_MARGIN = COMBAT.textMargin(); const statBarDimensions = (team, iter, margin) => { const statBarWidth = COMBAT.width() * 0.07;