1
Fork 0

Allow more fine controls for main sound track

This commit is contained in:
Jake Howard 2015-05-12 22:42:46 +01:00
parent f8e2e5df71
commit 1b44b11144
2 changed files with 7 additions and 2 deletions

View file

@ -67,6 +67,9 @@ def init_sounds():
music_files = ["main.wav", "OP.wav", "shot.wav"] music_files = ["main.wav", "OP.wav", "shot.wav"]
for file in music_files: for file in music_files:
path = os.path.dirname(os.path.realpath(__file__)) + "\\resources\\sounds\\" + file 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) mixer.set_volume(1.0)
Sounds[file.replace(".wav", "")] = mixer Sounds[file.replace(".wav", "")] = mixer

View file

@ -154,11 +154,13 @@ def play(window, options):
if len(target_group) == 0: #If all current players are gone. if len(target_group) == 0: #If all current players are gone.
player.level += 1 player.level += 1
Sounds["main"].set_volume(0.5)
target_group = generate_targets(player, WINDOW_SIZE, Levels) target_group = generate_targets(player, WINDOW_SIZE, Levels)
target_group.draw(window) target_group.draw(window)
bullet_group.empty() bullet_group.empty()
pygame.display.update() pygame.display.update()
sleep(1.5) sleep(0.75)
Sounds["main"].set_volume(1.0)
if player.OP: if player.OP:
player.change_colour((255,96,0)) #override colour change if changed before player.change_colour((255,96,0)) #override colour change if changed before