diff --git a/pybottle/bottle-blaster.py b/pybottle/bottle-blaster.py index 22972d1..62351c4 100755 --- a/pybottle/bottle-blaster.py +++ b/pybottle/bottle-blaster.py @@ -4,7 +4,7 @@ from storm_games import * -initialize_gui("Bottle Blaster") +sounds = initialize_gui("Bottle Blaster") # loop forever (until a break occurs) while True: @@ -12,9 +12,9 @@ while True: event = pygame.event.wait() # if the event is about a keyboard button that have been pressed... if event.type == pygame.KEYDOWN: - soundData['bottle'].play(-1) + sounds['bottle'].play(-1) if event.type == pygame.KEYUP: - soundData['bottle'].stop() + sounds['bottle'].stop() # and if the button is the "q" letter or the "escape" key... if event.key == pygame.K_ESCAPE: # ... then exit from the while loop diff --git a/pybottle/storm_games.py b/pybottle/storm_games.py index 31ef4e3..b5c631f 100755 --- a/pybottle/storm_games.py +++ b/pybottle/storm_games.py @@ -22,3 +22,4 @@ def initialize_gui(gameTitle): soundData = {} for f in soundFiles: soundData[f.split('.')[0]] = pygame.mixer.Sound("sounds/" + f) + return soundData