Return to repo list

gatemender

Arcade game about fixing warp gates. LibreJam Dec 2020 Entry.
Return to HMagellan.com

commit 89816285644b517799a60b3ebae127ec51562cf0
parent 0f97eade15642bf2dc5328a7f300ae500b17fb67
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Mon, 14 Dec 2020 17:29:29 -0600

Fixed music loop failure

Diffstat:
Msrc/game.py | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/game.py b/src/game.py @@ -24,7 +24,7 @@ class Game(object): self.images[i].set_colorkey(COLORKEY) self.keys = { CONTROLS[k] : False for k in CONTROLS } self.sounds = { s : pygame.mixer.Sound(SOUND_FILES[s]) for s in SOUND_FILES } - self.channels = [pygame.mixer.Channel(x) for x in range(0, pygame.mixer.get_num_channels() - 1)] + self.channels = [ pygame.mixer.Channel(x) for x in range(0, pygame.mixer.get_num_channels() - 1) ] # Game objects self.screen_draw_group = pygame.sprite.Group() @@ -162,11 +162,11 @@ class Game(object): self.score = 0 self.level_factor = 1 - def play_sound(self, soundname, channel = None, concurrent = True): + def play_sound(self, soundname, channel = None, concurrent = True, loops = -1): if channel != None and not self.channels[channel].get_busy(): - self.channels[channel].play(self.sounds[soundname]) + self.channels[channel].play(self.sounds[soundname], loops) elif concurrent or self.sounds[soundname].get_num_channels() == 0: - self.sounds[soundname].play() + self.sounds[soundname].play(loops) def render_hud(self): if self.mode == MODES.Play: