From 9fb8083952c1ebe11e16b09ace8eb3e75961ba63 Mon Sep 17 00:00:00 2001 From: ducaale Date: Sun, 9 Feb 2020 21:46:51 +0000 Subject: [PATCH] add support for playing sounds --- play/play.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/play/play.py b/play/play.py index 07881d9..0d27a79 100644 --- a/play/play.py +++ b/play/play.py @@ -5,6 +5,7 @@ import pygame pygame.init() +import pygame.mixer import pygame.gfxdraw import pymunk as _pymunk @@ -1348,8 +1349,15 @@ def color(self, color_): self._color = color_ self._should_recompute_primary_surface = True +def new_sound(sound): + return Sound(sound) +class Sound(): + def __init__(self, sound): + self.sound = pygame.mixer.Sound(sound) + def play(self): + self.sound.play() # @decorator def when_sprite_clicked(*sprites):