From 1b44b11144d5e554180efb59154f1998d7c16be6 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 12 May 2015 22:42:46 +0100 Subject: [PATCH] Allow more fine controls for main sound track --- assets.py | 5 ++++- game.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/assets.py b/assets.py index dea7a4c..a2f3eea 100644 --- a/assets.py +++ b/assets.py @@ -67,6 +67,9 @@ def init_sounds(): music_files = ["main.wav", "OP.wav", "shot.wav"] for file in music_files: path = os.path.dirname(os.path.realpath(__file__)) + "\\resources\\sounds\\" + file - mixer = pygame.mixer.Sound(path) + if file == "main.wav": + mixer = pygame.mixer.music + mixer.load(path) + else: mixer = pygame.mixer.Sound(path) mixer.set_volume(1.0) Sounds[file.replace(".wav", "")] = mixer \ No newline at end of file diff --git a/game.py b/game.py index 1ad850f..df6b5a4 100644 --- a/game.py +++ b/game.py @@ -154,11 +154,13 @@ def play(window, options): if len(target_group) == 0: #If all current players are gone. player.level += 1 + Sounds["main"].set_volume(0.5) target_group = generate_targets(player, WINDOW_SIZE, Levels) target_group.draw(window) bullet_group.empty() pygame.display.update() - sleep(1.5) + sleep(0.75) + Sounds["main"].set_volume(1.0) if player.OP: player.change_colour((255,96,0)) #override colour change if changed before