From 92bec392489c87e123a239bf82cb36bcab01b2b5 Mon Sep 17 00:00:00 2001 From: Renge Date: Sat, 23 Apr 2022 15:36:15 -0400 Subject: [PATCH] fix: UIs --- src/shattered_sword/Scenes/GameLevel.ts | 37 +++++++++++++------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index aa58845..fd9a23c 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -363,10 +363,10 @@ export default class GameLevel extends Scene { //update health UI let playerAI = (this.player.ai); - this.healthLabel.text = "Health: "+ playerAI.CURRENT_HP +'/' + (playerAI.MAX_HP +playerAI.CURRENT_BUFFS.hp ); - this.healthBar.size.set(playerAI.MAX_HP*2, 10); - this.healthBar.position.set(playerAI.MAX_HP+50, 40); - this.healthBar.fillWidth = playerAI.CURRENT_HP*2; + this.healthLabel.text = "Health: "+ Math.round(playerAI.CURRENT_HP) +'/' + Math.round(playerAI.MAX_HP +playerAI.CURRENT_BUFFS.hp); + this.healthBar.size.set(playerAI.MAX_HP*1.5, 10); + this.healthBar.position.set(playerAI.MAX_HP*0.75+20, 20); + this.healthBar.fillWidth = playerAI.CURRENT_HP*1.5; if (playerAI.CURRENT_HP/playerAI.MAX_HP >= 2/3) { this.healthBar.color = Color.GREEN; this.healthLabel.textColor = Color.GREEN; @@ -382,14 +382,14 @@ export default class GameLevel extends Scene { // this.healthLabel.sizeToText(); //update shield ui - this.shieldLabel.text = "Shield: "+ playerAI.CURRENT_SHIELD +'/' + (playerAI.MAX_SHIELD); - this.shieldBar.size.set(playerAI.CURRENT_SHIELD*2, 10); - this.shieldBar.position.set(playerAI.CURRENT_SHIELD+50, 70); + this.shieldLabel.text = "Shield: "+ Math.round(playerAI.CURRENT_SHIELD) +'/' + Math.round(playerAI.MAX_SHIELD); + this.shieldBar.size.set(playerAI.CURRENT_SHIELD*1.5, 10); + this.shieldBar.position.set(playerAI.CURRENT_SHIELD*0.75+20, 50); // this.shieldLabel.sizeToText(); //update exp ui - this.expLabel.text = "EXP: "+ playerAI.CURRENT_EXP +'/' + (playerAI.MAX_EXP); - this.expBar.fillWidth = (playerAI.CURRENT_EXP/playerAI.MAX_EXP)*200; + this.expLabel.text = "EXP: "+ Math.round(playerAI.CURRENT_EXP) +'/' + Math.round(playerAI.MAX_EXP); + this.expBar.fillWidth = (playerAI.CURRENT_EXP/playerAI.MAX_EXP)*150; // this.expLabel.sizeToText(); @@ -497,12 +497,13 @@ export default class GameLevel extends Scene { */ protected addUI(){ // In-game labels - this.healthLabel =