diff --git a/__init__.py b/__init__.py index 0dd58c4..2f82a97 100755 --- a/__init__.py +++ b/__init__.py @@ -332,9 +332,20 @@ def obj_play(sounds, soundName, player_pos, obj_pos, loop=True): if x: x.set_volume(volume * left, volume * right) return x + +def obj_update(x, player_pos, obj_pos): + if x is None: + return None + volume, left, right = calculate_volume_and_pan(player_pos, obj_pos) + if volume == 0: + x.stop() + return None + # Apply the volume and pan + x.set_volume(volume * left, volume * right) + return x def obj_stop(x): - """Tries to stop a playing object channel""" + # Tries to stop a playing object channel try: x.stop() return None