diff --git a/libstormgames.py b/libstormgames.py index 737ba74..817a258 100755 --- a/libstormgames.py +++ b/libstormgames.py @@ -176,7 +176,7 @@ def cut_scene(sounds, soundName): def obj_play(sounds, soundName, playerPos, objPos): if playerPos - objPos > 9 or playerPos - objPos < -9: # The sound is out of range, so do nothing. - return + return None distance = playerPos - objPos angle = math.radians(distance * 5) left = math.sqrt(2)/2.0 * (math.cos(angle) - math.sin(angle)) @@ -196,7 +196,7 @@ def obj_update(x, playerPos, objPos): # attempt to stop sounds that go out of range. if playerPos - objPos > 9 or playerPos - objPos < -9: obj_stop(x) - return + return None distance = playerPos - objPos angle = math.radians(distance * 5) left = math.sqrt(2)/2.0 * (math.cos(angle) - math.sin(angle)) @@ -207,13 +207,16 @@ def obj_update(x, playerPos, objPos): right *= -1 # Apply the position information to the channel x.set_volume(left, right) + # return the channel + return x def obj_stop(x): # Tries to stop a playing object channel try: x.stop() + return None except: - pass + return x def play_random(sounds, soundName, pause = False, interrupt = False): key = []