From 80fe2caff3921ef2073e9f145e51a29cbdf80f1b Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 3 Feb 2025 23:59:46 -0500 Subject: [PATCH] Oops, accidentally removed the obj_update function. --- __init__.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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