about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--brutalmaze/characters.py2
-rw-r--r--brutalmaze/constants.py1
-rw-r--r--brutalmaze/maze.py4
-rw-r--r--brutalmaze/misc.py2
-rw-r--r--brutalmaze/soundfx/spawn.oggbin0 -> 8810 bytes
-rwxr-xr-xsetup.py2
6 files changed, 8 insertions, 3 deletions
diff --git a/brutalmaze/characters.py b/brutalmaze/characters.py
index a7e0513..d28ea0b 100644
--- a/brutalmaze/characters.py
+++ b/brutalmaze/characters.py
@@ -169,6 +169,8 @@ class Enemy:
                 if get_distance(x - self.maze.x, y - self.maze.y) <= mind:
                     return False
         self.awake = True
+        play(self.maze.sfx_spawn, self.maze.get_distance(*self.get_pos()),
+             self.get_angle() + pi)
         return True
 
     def fire(self):
diff --git a/brutalmaze/constants.py b/brutalmaze/constants.py
index 5e96922..21d821b 100644
--- a/brutalmaze/constants.py
+++ b/brutalmaze/constants.py
@@ -25,6 +25,7 @@ from pkg_resources import resource_filename
 
 ICON = image.load(resource_filename('brutalmaze', 'icon.png'))
 MUSIC = resource_filename('brutalmaze', 'soundfx/music.ogg')
+SFX_SPAWN = resource_filename('brutalmaze', 'soundfx/spawn.ogg')
 SFX_SLASH_ENEMY = resource_filename('brutalmaze', 'soundfx/slash-enemy.ogg')
 SFX_SLASH_HERO = resource_filename('brutalmaze', 'soundfx/slash-hero.ogg')
 SFX_SHOT_ENEMY = resource_filename('brutalmaze', 'soundfx/shot-enemy.ogg')
diff --git a/brutalmaze/maze.py b/brutalmaze/maze.py
index b958299..2123a74 100644
--- a/brutalmaze/maze.py
+++ b/brutalmaze/maze.py
@@ -25,7 +25,7 @@ from random import choice, getrandbits, uniform
 
 import pygame
 from pygame import RESIZABLE
-from pygame.mixer import Sound, set_num_channels
+from pygame.mixer import Sound
 from pygame.time import get_ticks
 
 from .characters import Hero, new_enemy
@@ -105,6 +105,7 @@ class Maze:
         self.next_move = self.next_slashfx = 0
         self.slashd = self.hero.R + self.distance/SQRT2
 
+        self.sfx_spawn = Sound(SFX_SPAWN)
         self.sfx_slash = Sound(SFX_SLASH_ENEMY)
         self.sfx_shot = Sound(SFX_SHOT_ENEMY)
         self.sfx_lose = Sound(SFX_LOSE)
@@ -126,7 +127,6 @@ class Maze:
                 walls.remove((x, y))
             else:
                 self.map[x][y] = WALL
-        set_num_channels(int(num * 3))
 
     def get_pos(self, x, y):
         """Return coordinate of the center of the grid (x, y)."""
diff --git a/brutalmaze/misc.py b/brutalmaze/misc.py
index 6f79c0b..eb2d45c 100644
--- a/brutalmaze/misc.py
+++ b/brutalmaze/misc.py
@@ -85,6 +85,8 @@ def choices(d):
 
 def play(sound, volume, angle=None):
     """Play a pygame.mixer.Sound at the given volume."""
+    if pygame.mixer.find_channel() is None:
+        pygame.mixer.set_num_channels(pygame.mixer.get_num_channels() + 1)
     if angle is None:
         sound.set_volume(volume)
         sound.play()
diff --git a/brutalmaze/soundfx/spawn.ogg b/brutalmaze/soundfx/spawn.ogg
new file mode 100644
index 0000000..fb1d2a1
--- /dev/null
+++ b/brutalmaze/soundfx/spawn.ogg
Binary files differdiff --git a/setup.py b/setup.py
index 2f9e07a..092ad24 100755
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ with open('README.rst') as f:
 
 setup(
     name='brutalmaze',
-    version='0.3.4',
+    version='0.3.5',
     description='A hash and slash game with fast-paced action and a minimalist art style',
     long_description=long_description,
     url='https://github.com/McSinyx/brutalmaze',