Skip to content

Commit

Permalink
fix controller manager
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek10351 committed Oct 9, 2023
1 parent e186455 commit f9b6ade
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions game/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ def __init__(self, width, height, title):
self.bg_music = arcade.load_sound("assets/music/funkyrobot.mp3")
self.bg_music_player = self.bg_music.play(
volume=self.volume/100, loop=True)
if fetch("SELECT music FROM settings;")[0] == 0:
self.bg_music_player.pause()

self.controller_manager = pyglet.input.ControllerManager()
self.controller_manager.update()
controllers = self.controller_manager.get_controllers()
self.controller = None
if controllers:
Expand All @@ -51,8 +53,7 @@ def on_disconnect(controller):
self.controller.close()
self.controller = None
print("Disconnected:", controller)
if fetch("SELECT music FROM settings;")[0] == 0:
self.bg_music_player.pause()

self.game_level_time = timedelta(seconds=0.0)

def on_update(self, delta_time):
Expand Down

0 comments on commit f9b6ade

Please sign in to comment.