« get me outta code hell

Visual significant stun feedback - 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-17 09:12:51 -0300
committerFlorrie <towerofnix@gmail.com>2018-08-17 09:12:51 -0300
commit62a74e3f812b81da5195313d0498b9adbbc59621 (patch)
tree09714c61ef811318e727b4e7b2edd5500d7c5526
parent0cc49bacfab18e8e146fec890674b489e8a192e4 (diff)
Visual significant stun feedback
-rw-r--r--index.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/index.js b/index.js
index c927385..955fcb7 100644
--- a/index.js
+++ b/index.js
@@ -93,7 +93,11 @@ class ATBBar {
     ctx.rect(0, 0, Math.round(this.canvas.width * this.visualProgress), this.canvas.height)
     ctx.clip()
 
-    ctx.fillStyle = '#77F'
+    if (this.battleCharacter.stunIsSignificant) {
+      ctx.fillStyle = '#888'
+    } else {
+      ctx.fillStyle = '#77F'
+    }
     ctx.fillRect(0, 0, this.canvas.width, this.canvas.height)
 
     ctx.restore()
@@ -134,6 +138,15 @@ class ATBBar {
         i += action.size
       }
     }
+
+    if (this.battleCharacter.stunIsSignificant) {
+      ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'
+      ctx.fillRect(0, 0, this.canvas.width, this.canvas.height)
+      ctx.textAlign = 'left'
+      ctx.fillStyle = 'black'
+      ctx.font = '5px pixel-font'
+      ctx.fillText('Stunned!', 2, this.canvas.height / 2 + 2.5)
+    }
   }
 
   update(dt) {
@@ -247,7 +260,6 @@ class ATBBar {
       if (action.cooldown) {
         this.battleCharacter.cooldownTimers[action.id] = action.cooldown * this.segmentCount
         this.battleCharacter.cooldownTimers[action.id] -= this.segmentCount - this.getRemainingSpace()
-        console.log('Enqueued cooldown:', action.label, action.cooldown * this.segmentCount, this.battleCharacter.cooldownTimers[action.id])
       }
       this.queuedActions.push(action)
       return true