Mercurial > skaapsteker
changeset 263:44cd7cfd2de3
Yelp when hit
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Fri, 08 Apr 2011 11:47:33 +0200 |
parents | de60329cfc9f |
children | afd9256ad682 |
files | data/sounds/sources.txt data/sounds/yelp.ogg skaapsteker/levelscene.py skaapsteker/sound.py skaapsteker/sprites/player.py |
diffstat | 5 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/data/sounds/sources.txt Fri Apr 08 11:29:37 2011 +0200 +++ b/data/sounds/sources.txt Fri Apr 08 11:47:33 2011 +0200 @@ -4,3 +4,11 @@ Generated 2 secs of silence - dd if=/dev/zero of=silence.pcm bs=176400 count=2 ; oggenc -r silence.pcm Generated by Neil Muller, Aug 2010 Not copyrightable. + +[yelp.ogg] +URL: http://www.archive.org/download/tamtam44old/tamtam44old.zip +Source: http://www.archive.org/details/tamtam44old +License: http://creativecommons.org/licenses/by/3.0/ +Credit: Sound samples for tamtam recorded by Richard Boulanger for use in the One Laptop per Child music library. See http://wiki.laptop.org/go/Sound_samples for details +yelp.ogg wavfile: ounk.wav +
--- a/skaapsteker/levelscene.py Fri Apr 08 11:29:37 2011 +0200 +++ b/skaapsteker/levelscene.py Fri Apr 08 11:47:33 2011 +0200 @@ -19,7 +19,7 @@ def __init__(self, game_state, soundsystem, leveldef): super(LevelScene, self).__init__(game_state, soundsystem) - self._player = player.Player(game_state.world) + self._player = player.Player(game_state.world, soundsystem) self._level = level.Level(leveldef, self._player, soundsystem) self._leveldef = leveldef self._player_dead = False
--- a/skaapsteker/sound.py Fri Apr 08 11:29:37 2011 +0200 +++ b/skaapsteker/sound.py Fri Apr 08 11:47:33 2011 +0200 @@ -43,7 +43,7 @@ if not self.sound_enabled: self._sounds[key] = None else: - self._sounds[key] = pygame.sound.Sound(data.filepath(track_name)) + self._sounds[key] = pygame.mixer.Sound(data.filepath(track_name)) def play_sound(self, key): sound = self._sounds.get(key, None)
--- 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()