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
This commit is contained in:
parent
37aa764d68
commit
536659338e
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user