« get me outta code hell

Left/right to change power of action - csb-game - Pixelly spin-off of the Command Synergy Battle system used in Final Fantasy XIII
summary refs log tree commit diff
path: root/index.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-08-09 19:00:03 -0300
committerFlorrie <towerofnix@gmail.com>2018-08-09 19:00:03 -0300
commit5c32bcdb7d6b8cd923faed23c10692ce049d279e (patch)
tree3d62b0b0a5ce940cd93d794fb467fef2813a0a40 /index.js
parentbce822d92c4b0ea7f49f7e18a858e16e85d79b2c (diff)
Left/right to change power of action
Diffstat (limited to 'index.js')
-rw-r--r--index.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/index.js b/index.js
index ca401a5..72535a0 100644
--- a/index.js
+++ b/index.js
@@ -162,6 +162,20 @@ class ActionMenu {
       this.currentOptionIndex = this.options.length - 1
     }
   }
+
+  increaseLevel() {
+    this.uiLevel++
+    if (this.uiLevel > 3) {
+      this.uiLevel = 3
+    }
+  }
+
+  decreaseLevel() {
+    this.uiLevel--
+    if (this.uiLevel < 1) {
+      this.uiLevel = 1
+    }
+  }
 }
 
 const atbBar = new ATBBar()
@@ -195,6 +209,10 @@ canvas.addEventListener('keypress', evt => {
     actionMenu.upOption()
   } else if (evt.keyCode === 40) {
     actionMenu.downOption()
+  } else if (evt.keyCode === 37) {
+    actionMenu.decreaseLevel()
+  } else if (evt.keyCode === 39) {
+    actionMenu.increaseLevel()
   }
 })