squirrel-battle/dungeonbattle/menus.py

14 lines
344 B
Python

class Menu:
def __init__(self, values:list):
self.values = values
self.position = 0
def go_up(self):
self.position = max(0, self.position -1)
def go_down(self):
self.position = min(len(self.values)-1, self.position +1)
def validate(self):
return self.values[self.position]