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):
|
def attack(self, currentTime, player):
|
||||||
"""Perform attack on player"""
|
"""Perform attack on player"""
|
||||||
|
if player.isInvincible: return
|
||||||
self.lastAttackTime = currentTime
|
self.lastAttackTime = currentTime
|
||||||
# Play attack sound
|
# Play attack sound
|
||||||
attackSound = f"{self.enemyType}_attack"
|
attackSound = f"{self.enemyType}_attack"
|
||||||
|
@@ -238,7 +238,7 @@ class Level:
|
|||||||
# Handle grave edge warnings
|
# Handle grave edge warnings
|
||||||
if obj.isHazard:
|
if obj.isHazard:
|
||||||
distance = abs(self.player.xPos - obj.xPos)
|
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():
|
if self.edge_warning_channel is None or not self.edge_warning_channel.get_busy():
|
||||||
self.edge_warning_channel = play_sound(self.sounds['edge'])
|
self.edge_warning_channel = play_sound(self.sounds['edge'])
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user