|
|
|
@ -142,16 +142,12 @@ class MiceMaze(controls.KeyBindings): |
|
|
|
self.engine.scroll_view(self.pointer) |
|
|
|
self.engine.scroll_view(self.pointer) |
|
|
|
|
|
|
|
|
|
|
|
def play_sound(self, sound_file,tag="main"): |
|
|
|
def play_sound(self, sound_file,tag="main"): |
|
|
|
self.engine.play_sound(sound_file) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if self.audio: |
|
|
|
if self.audio: |
|
|
|
if len(self.sounds) > 5: |
|
|
|
if len(self.sounds) > 5: |
|
|
|
self.sounds.pop(next(iter(self.sounds))).kill() |
|
|
|
self.sounds.pop(next(iter(self.sounds))).kill() |
|
|
|
self.sounds[f"{tag}_{random.random()}"] = subprocess.Popen(["aplay", f"sound/{sound_file}"]) |
|
|
|
self.sounds[f"{tag}_{random.random()}"] = subprocess.Popen(["aplay", f"sound/{sound_file}"]) |
|
|
|
|
|
|
|
|
|
|
|
def stop_sound(self, tag=None): |
|
|
|
def stop_sound(self, tag=None): |
|
|
|
self.engine.stop_sound() |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
for key, value in self.sounds.copy().items(): |
|
|
|
for key, value in self.sounds.copy().items(): |
|
|
|
if tag is None or tag in key: |
|
|
|
if tag is None or tag in key: |
|
|
|
value.kill() |
|
|
|
value.kill() |
|
|
|
|