Extra life added, fixed sounds to use the new functions for volume control Other various improvements.

This commit is contained in:
Storm Dragon
2025-02-04 07:12:12 -05:00
parent 4f7f5504d1
commit 883dafaac0
9 changed files with 61 additions and 34 deletions

View File

@@ -33,7 +33,7 @@ class SkullStorm(Object):
inRange = self.xRange[0] <= player.xPos <= self.xRange[1]
if inRange and not self.playerInRange:
# Player just entered range - play the warning sound
self.sounds['skull_storm'].play()
play_sound(self.sounds['skull_storm'])
self.playerInRange = True
elif not inRange and self.playerInRange: # Only speak when actually leaving range
# Player just left range
@@ -62,7 +62,7 @@ class SkullStorm(Object):
skull['x'],
self.yPos,
currentY,
existingChannel=skull['channel']
existing_channel=skull['channel']
)
# Check if we should spawn a new skull
@@ -100,10 +100,7 @@ class SkullStorm(Object):
channel = pygame.mixer.find_channel(True) # Find an available channel
if channel:
soundObj = self.sounds['skull_lands']
channel.play(soundObj, 0) # Play once (0 = no loops)
# Apply positional audio
volume, left, right = calculate_volume_and_pan(player.xPos, skull['x'])
channel.set_volume(volume * left, volume * right)
obj_play(self.sounds, 'skull_lands', player.xPos, skull['x'], loop=False)
# Check if player was hit
if abs(player.xPos - skull['x']) < 1: # Within 1 tile