Occasional sounds
authorNeil <neil@dip.sun.ac.za>
Wed, 7 Sep 2016 19:41:14 +0000 (21:41 +0200)
committerNeil <neil@dip.sun.ac.za>
Wed, 7 Sep 2016 19:41:22 +0000 (21:41 +0200)
tabakrolletjie/enemies.py

index 7ed6cf9f7355b63a9edb013efb9ecc19266e35e9..0fe1619fc175f63b970deb882e8d1ed5a15e6e6a 100644 (file)
@@ -12,6 +12,7 @@ import pygame.locals as pgl
 
 from .constants import SCREEN_SIZE, MOULD_CATEGORY, OBSTACLE_CATEGORY
 from .loader import loader
+from .sound import sound
 
 MOULD_FILTER = pymunk.ShapeFilter(
     mask=MOULD_CATEGORY | OBSTACLE_CATEGORY,
@@ -88,6 +89,8 @@ class Mould(pymunk.Body):
                 child._health = self._health
                 moulds.append(child)
                 refresh = True
+                if random.randint(0, 10) < 2:
+                    sound.play_sound("mouth_pop_2a.ogg")
 
         if self._age in (10, 20):
             # Segment grows in size