Grave edge sounds and player hit sounds do not play if you are not vulnerable to them.

This commit is contained in:
Storm Dragon
2025-02-06 03:40:29 -05:00
parent 641e7dcd11
commit 59225c1c79
2 changed files with 2 additions and 1 deletions

View File

@@ -144,6 +144,7 @@ class Enemy(Object):
def attack(self, currentTime, player):
"""Perform attack on player"""
if player.isInvincible: return
self.lastAttackTime = currentTime
# Play attack sound
attackSound = f"{self.enemyType}_attack"

View File

@@ -238,7 +238,7 @@ class Level:
# Handle grave edge warnings
if obj.isHazard:
distance = abs(self.player.xPos - obj.xPos)
if distance <= 2 and not self.player.isJumping:
if distance <= 2 and not self.player.isJumping and not self.player.isInvincible:
if self.edge_warning_channel is None or not self.edge_warning_channel.get_busy():
self.edge_warning_channel = play_sound(self.sounds['edge'])
else: