Updated libstormgames submodule. Rewrite load level on death. This was actually a lot easier than I was making it.

This commit is contained in:
Storm Dragon
2025-02-06 13:24:00 -05:00
parent 59225c1c79
commit 3c931b83ac
3 changed files with 7 additions and 11 deletions

View File

@@ -152,8 +152,6 @@ class Player:
# Stop all current sounds before playing death sound # Stop all current sounds before playing death sound
pygame.mixer.stop() pygame.mixer.stop()
cut_scene(self.sounds, 'lose_a_life') cut_scene(self.sounds, 'lose_a_life')
if self._lives > 0:
self.reset_on_death()
def set_max_health(self, value): def set_max_health(self, value):
"""Set max health""" """Set max health"""
@@ -167,13 +165,6 @@ class Player:
"""Get remaining lives""" """Get remaining lives"""
return self._lives return self._lives
def reset_on_death(self):
"""Reset player state after death"""
self._health = self._maxHealth
self.isJumping = False
self.isRunning = False
self.xPos = 0
def add_weapon(self, weapon): def add_weapon(self, weapon):
"""Add a new weapon to inventory and equip if first weapon""" """Add a new weapon to inventory and equip if first weapon"""
self.weapons.append(weapon) self.weapons.append(weapon)

View File

@@ -188,9 +188,14 @@ class WickedQuest:
pygame.mixer.stop() pygame.mixer.stop()
self.display_game_over(pygame.time.get_ticks() - startTime) self.display_game_over(pygame.time.get_ticks() - startTime)
return return
else:
pygame.mixer.stop()
self.load_level(currentLevelNum)
self.currentLevel.player._health = self.currentLevel.player._maxHealth # Restore health
continue
# Handle collisions and check level completion # Handle collisions and check level completion
if self.currentLevel.handle_collisions(): # Changed from elif to if if self.currentLevel.handle_collisions():
# Level completed # Level completed
self.display_level_stats(pygame.time.get_ticks() - startTime) self.display_level_stats(pygame.time.get_ticks() - startTime)