It's always the small, simple changes that cause the most problems. Invulnerability system hopefully working for real this time.

This commit is contained in:
Storm Dragon
2025-02-17 15:21:45 -05:00
parent 4de969496d
commit e6d8f09410
2 changed files with 27 additions and 25 deletions

View File

@@ -152,7 +152,11 @@ class Level:
spawn_type=obj.get("spawn_type", "zombie"),
spawn_cooldown=obj.get("spawn_cooldown", 2000),
spawn_chance=obj.get("spawn_chance", 25),
spawn_distance=obj.get("spawn_distance", 5)
spawn_distance=obj.get("spawn_distance", 5),
has_vulnerability=obj.get("has_vulnerability", False),
is_vulnerable=obj.get("is_vulnerable", False),
vulnerability_duration=obj.get("vulnerability_duration", 1000),
invulnerability_duration=obj.get("invulnerability_duration", 5000)
)
self.enemies.append(enemy)
else:
@@ -221,6 +225,7 @@ class Level:
enemy.update(currentTime, self.player)
# Only handle audio for non-vulnerability enemies
if not enemy.hasVulnerabilitySystem:
if enemy.channel is None or not enemy.channel.get_busy():
enemy.channel = obj_play(self.sounds, enemy.enemyType, self.player.xPos, enemy.xPos)