diff options
author | Florrie <towerofnix@gmail.com> | 2018-08-09 19:00:03 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-08-09 19:00:03 -0300 |
commit | 5c32bcdb7d6b8cd923faed23c10692ce049d279e (patch) | |
tree | 3d62b0b0a5ce940cd93d794fb467fef2813a0a40 | |
parent | bce822d92c4b0ea7f49f7e18a858e16e85d79b2c (diff) |
Left/right to change power of action
-rw-r--r-- | index.js | 18 |
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() } }) |