From 96f1f6b3c25a7a06b9b27de981b9c5f580bd8ba6 Mon Sep 17 00:00:00 2001 From: "Waylon S. Walker" Date: Thu, 12 Jan 2023 17:48:31 -0600 Subject: [PATCH] fix menu debounces --- creeper_adventure/creeper.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/creeper_adventure/creeper.py b/creeper_adventure/creeper.py index 08d2acb..50dac64 100755 --- a/creeper_adventure/creeper.py +++ b/creeper_adventure/creeper.py @@ -613,11 +613,11 @@ class Creeper(Game): for joystick in self.joysticks.values(): if ( keys[pygame.K_e] or joystick.get_button(2) - ) and self.inventory_open_debounce: + ) and self.controller_inventory_open_debounce: self.inventory_menu.is_open = not self.inventory_menu.is_open - self.inventory_open_debounce = 0 - elif not (keys[pygame.K_e] or joystick.get_button(2)): - self.inventory_open_debounce = 1 + self.controller_inventory_open_debounce = 0 + elif not keys[pygame.K_e] and not joystick.get_button(2): + self.controller_inventory_open_debounce = 1 def main_keys(self): keys = self.keys @@ -633,11 +633,11 @@ class Creeper(Game): for joystick in self.joysticks.values(): if ( keys[pygame.K_ESCAPE] or joystick.get_button(9) - ) and self.main_open_debounce: + ) and self.controller_main_open_debounce: self.main_menu.is_open = not self.main_menu.is_open - self.main_open_debounce = 0 + self.controller_main_open_debounce = 0 elif not (keys[pygame.K_ESCAPE] or joystick.get_button(9)): - self.main_open_debounce = 1 + self.controller_main_open_debounce = 1 def make_sound(self): if not hasattr(self, "last_x"):