From: Neil Date: Sat, 5 Mar 2016 22:53:18 +0000 (+0200) Subject: Scream when attacked X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=904210579419bccf387baa2ad9068a6a19189f04;p=koperkapel.git Scream when attacked --- diff --git a/koperkapel/scenes/level.py b/koperkapel/scenes/level.py index ca85884..3b3b315 100644 --- a/koperkapel/scenes/level.py +++ b/koperkapel/scenes/level.py @@ -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)