diff --git a/libstormgames.py b/libstormgames.py index 51e251f..9353949 100755 --- a/libstormgames.py +++ b/libstormgames.py @@ -174,11 +174,12 @@ def cut_scene(sounds, soundName): pygame.event.pump() 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 None distance = playerPos - objPos - if distance == 0: + if distance > 9 or distance < -9: + # The item is out of range, so play it at 0 + left = 0 + right = 0 + elif distance == 0: left = 0.9 right = 0.9 else: @@ -195,12 +196,11 @@ def obj_play(sounds, soundName, playerPos, objPos): return x 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 None distance = playerPos - objPos - if distance == 0: + if distance > 9 or distance < -9: + left = 0 + right = 0 + elif distance == 0: left = 0.9 right = 0.9 else: