Mercurial > skaapsteker
diff skaapsteker/sprites/player.py @ 263:44cd7cfd2de3
Yelp when hit
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Fri, 08 Apr 2011 11:47:33 +0200 |
parents | dff6287b55b7 |
children | be516ca5e3b8 |
line wrap: on
line diff
--- a/skaapsteker/sprites/player.py Fri Apr 08 11:29:37 2011 +0200 +++ b/skaapsteker/sprites/player.py Fri Apr 08 11:47:33 2011 +0200 @@ -16,11 +16,13 @@ collides_with = set([MONSTER_LAYER]) wants_updates = True - def __init__(self, the_world): + def __init__(self, the_world, soundsystem): Sprite.__init__(self) self.image = None self.rect = None self._image_dict = {} + self._soundsystem = soundsystem + self._soundsystem.load_sound('yelp', 'sounds/yelp.ogg') self._animation_frame = 0.0 self._last_time = time.time() # State flags and such @@ -156,6 +158,7 @@ def damage(self, damage): self.the_world.fox.cur_health -= damage + self._soundsystem.play_sound('yelp') if self.the_world.fox.cur_health <= 0: PlayerDied.post()