From 536659338ebbea675a0021b7ec2a399a9424bf3a Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 10 Sep 2020 18:02:53 -0400 Subject: [PATCH] Updated the object placement code code so that if sounds are out of range they still clame the channel, but they do not play at an audible level.[A --- libstormgames.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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: