« get me outta code hell

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:
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()
   }
 })