From b271242bc97297a8da30ba93d7b9534d7a8c893e Mon Sep 17 00:00:00 2001 From: Storm dragon Date: Mon, 21 Mar 2016 06:42:53 -0400 Subject: [PATCH] Yay. it works... I gotta remember to pay more attention to scope lol. --- pybottle/bottle-blaster.py | 6 +++--- pybottle/storm_games.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) 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