« get me outta code hell

Fix order of HP bar rendering - 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-19 15:30:21 -0300
committerFlorrie <towerofnix@gmail.com>2018-08-19 15:30:21 -0300
commitf8a1ea210f120bb0f7e9ddd8895aa1391650ee71 (patch)
treee57987b3701a551386cb455778b66aa28a86b6b0
parent03633d5db719211e487991d66f76484cd8cd4d7c (diff)
Fix order of HP bar rendering
-rw-r--r--index.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/index.js b/index.js
index 1b7c633..5138e92 100644
--- a/index.js
+++ b/index.js
@@ -994,7 +994,9 @@ class Battle {
     ctx.drawImage(atbBar.canvas, 20, y - atbBar.canvas.height)
 
     y = canvas.height - 20
-    for (const { hpBar } of this.playerCharacter.team.characters) {
+    const hpBars = this.playerCharacter.team.characters.map(c => c.hpBar)
+    hpBars.reverse() // To match the order in the target menu
+    for (const hpBar of hpBars) {
       y -= hpBar.canvas.height
       hpBar.draw()
       const x = canvas.width - 20 - hpBar.canvas.width