Scream when attacked
authorNeil <neil@dip.sun.ac.za>
Sat, 5 Mar 2016 22:53:18 +0000 (00:53 +0200)
committerNeil <neil@dip.sun.ac.za>
Sat, 5 Mar 2016 22:54:06 +0000 (00:54 +0200)
koperkapel/scenes/level.py

index ca85884b75a2ccb0e4cbd3aec0494faf5ee4fff1..3b3b315fbbbeb9ac5e11308dd2b29690cfd6b0d6 100644 (file)
@@ -2,6 +2,7 @@
 
 import random
 from pgzero.constants import keys
+from pgzero.loaders import sounds
 from pygame import Surface
 import pygame.locals as pgl
 from ..loaders.levelloader import levels
@@ -130,6 +131,7 @@ class GameLevelScene(BaseLevelScene):
         self._key_rate = 0.2
         self._last_key_down = 0
         self._last_dmg = 0
+        self._screech = sounds.load("screech")
         return self._init_roaches(world)
 
     def _init_items(self):
@@ -205,6 +207,7 @@ class GameLevelScene(BaseLevelScene):
             return
         roach = random.choice(world.roaches)
         roach.health -= self._last_dmg
+        self._screech.play()
         self._last_dmg = 0
         if roach.health < 0:
             index = [x.name for x in world.roaches].index(roach.name)