Firing sound for catapult actually comes from the direction of the catapult. It still works if catapult itself is out of normal sound range.

This commit is contained in:
Storm Dragon
2025-02-24 14:55:07 -05:00
parent ce79f07805
commit 1b0a6eba83
2 changed files with 7 additions and 7 deletions

View File

@@ -75,21 +75,21 @@ class Catapult(Object):
def fire(self, currentTime, player):
"""Start the firing sequence"""
self.lastFireTime = currentTime
# Play launch sound
play_sound(self.sounds['catapult_launch'])
# Play launch sound using directional audio
play_directional_sound(self.sounds, 'catapult_launch', player.xPos, self.xPos)
# Set up pending pumpkin
isHigh = random.choice([True, False])
fireDirection = 1 if player.xPos > self.xPos else -1
# Store pumpkin data for later creation
self.pendingPumpkin = {
'isHigh': isHigh,
'direction': fireDirection,
'playerMaxHealth': player.get_max_health()
}
# Set when to actually launch the pumpkin
self.pumpkinLaunchTime = currentTime + self.launchDelay