Grave edge sounds and player hit sounds do not play if you are not vulnerable to them.
This commit is contained in:
@@ -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"
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user