From f8597666fa39fca408df5076cb0b237b39081ac0 Mon Sep 17 00:00:00 2001 From: Storm dragon Date: Mon, 21 Mar 2016 06:34:25 -0400 Subject: [PATCH] Latest code. Still not working. --- pybottle/bottle-blaster.py | 4 ++-- pybottle/storm_games.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pybottle/bottle-blaster.py b/pybottle/bottle-blaster.py index 5d27cf5..22972d1 100755 --- a/pybottle/bottle-blaster.py +++ b/pybottle/bottle-blaster.py @@ -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) + soundData['bottle'].play(-1) if event.type == pygame.KEYUP: - soundData["bottle"].stop() + soundData['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 31aa1e9..31ef4e3 100755 --- a/pybottle/storm_games.py +++ b/pybottle/storm_games.py @@ -17,8 +17,8 @@ def initialize_gui(gameTitle): pygame.display.set_mode((320, 200)) pygame.display.set_caption(gameTitle) # Load sounds from the sound directory and creates a list like that {'bottle': 'bottle.ogg'} - soundFiles = [f for f in listdir(SoundFolder) if isfile(join(SoundFolder, f)) and (f.split('.')[1].lower() in ["ogg","wav"])] + soundFiles = [f for f in listdir("sounds/") if isfile(join("sounds/", f)) and (f.split('.')[1].lower() in ["ogg","wav"])] #lets make a dict with pygame.mixer.Sound() objects {'bottle':} soundData = {} for f in soundFiles: - soundData[f.split('.')[0]] = pygame.mixer.Sound(SoundFolder + "/" + f) + soundData[f.split('.')[0]] = pygame.mixer.Sound("sounds/" + f)