fix menu debounces

This commit is contained in:
Waylon Walker 2023-01-12 17:48:31 -06:00
parent 3f5a10f090
commit 96f1f6b3c2
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4

View file

@ -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"):