« get me outta code hell

Show HP bars for all party members - csb-game - Pixelly spin-off of the Command Synergy Battle system used in Final Fantasy XIII
summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-08-12 11:34:55 -0300
committerFlorrie <towerofnix@gmail.com>2018-08-12 11:34:55 -0300
commitab45c4c7da290dcd5071b9e7729538ae3374f80b (patch)
treeb62cd34535c6db9ed43621f4bc49df4fd567b2e5
parentfeb7d1173d4a120edbfb9a348441fd2ebea7b9aa (diff)
Show HP bars for all party members
-rw-r--r--index.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/index.js b/index.js
index 02d5d9f..9faed1e 100644
--- a/index.js
+++ b/index.js
@@ -484,7 +484,7 @@ class Battle {
     }
     ctx.restore()
 
-    const { atbBar, hpBar } = this.playerCharacter
+    const { atbBar } = this.playerCharacter
 
     let y = canvas.height - 20
     if (this.currentMenu) {
@@ -498,9 +498,12 @@ class Battle {
     ctx.drawImage(atbBar.canvas, 20, y)
 
     y = canvas.height - 20
-    y -= hpBar.canvas.height
-    hpBar.draw()
-    ctx.drawImage(hpBar.canvas, canvas.width - 20 - hpBar.canvas.width, y)
+    for (const { hpBar } of this.playerCharacter.team.characters) {
+      y -= hpBar.canvas.height
+      hpBar.draw()
+      ctx.drawImage(hpBar.canvas, canvas.width - 20 - hpBar.canvas.width, y)
+      y -= 2
+    }
 
     if (targetCharacter) {
       const hpBar = targetCharacter.hpBar