diff options
-rw-r--r-- | index.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/index.js b/index.js index c7327d6..00b35b8 100644 --- a/index.js +++ b/index.js @@ -336,6 +336,8 @@ class BaseBattleMenu { return } + this.keepCurrentIndexInBounds() + this.drawY = 1 if (this.options.length > 3) { @@ -375,7 +377,12 @@ class BaseBattleMenu { return this.canvas.width - 2 } + keepCurrentIndexInBounds() { + this.currentOptionIndex = Math.min(this.options.length - 1, this.currentOptionIndex) + } + getCurrentOption() { + this.keepCurrentIndexInBounds() return this.options[this.currentOptionIndex] } |