A couple of small adjustments to level 12 and 13. Added the ability to lock levels meaning all enemies must be defeated before you can pass the right boundary. Raised the volume level of coffins a bit. Fixed hunter style attack patterns.
This commit is contained in:
16
src/level.py
16
src/level.py
@@ -22,10 +22,11 @@ class Level:
|
||||
self.player = player
|
||||
self.lastWarningTime = 0
|
||||
self.warningInterval = int(self.sounds['edge'].get_length() * 1000) # Convert seconds to milliseconds
|
||||
|
||||
self.weapon_hit_channel = None
|
||||
|
||||
self.leftBoundary = levelData["boundaries"]["left"]
|
||||
self.rightBoundary = levelData["boundaries"]["right"]
|
||||
self.isLocked = levelData.get("locked", False) # Default to False if not specified
|
||||
self.levelId = levelData["level_id"]
|
||||
|
||||
# Get footstep sound for this level, default to 'footstep' if not specified
|
||||
@@ -143,7 +144,8 @@ class Level:
|
||||
health=obj.get("health", 5),
|
||||
damage=obj.get("damage", 1),
|
||||
attack_range=obj.get("attack_range", 1),
|
||||
movement_range=obj.get("movement_range", 5)
|
||||
movement_range=obj.get("movement_range", 5),
|
||||
attack_pattern=obj.get("attack_pattern", {'type': 'patrol'}) # Add this line
|
||||
)
|
||||
self.enemies.append(enemy)
|
||||
else:
|
||||
@@ -394,7 +396,15 @@ class Level:
|
||||
if obj.soundName == "end_of_level":
|
||||
# Check if player has reached or passed the end marker
|
||||
if self.player.xPos >= obj.xPos:
|
||||
# Stop all current sounds and play end level sound
|
||||
# If level is locked, check for remaining enemies
|
||||
if self.isLocked and any(enemy.isActive for enemy in self.enemies):
|
||||
speak("You must defeat all enemies before proceeding!")
|
||||
play_sound(self.sounds['locked'])
|
||||
# Push player back a bit
|
||||
self.player.xPos -= 1
|
||||
return False
|
||||
|
||||
# Level complete
|
||||
pygame.mixer.stop()
|
||||
play_sound(self.sounds['end_of_level'])
|
||||
return True
|
||||
|
Reference in New Issue
Block a user