Levels and ambience updated.
This commit is contained in:
@@ -164,5 +164,6 @@
|
||||
"left": 0,
|
||||
"right": 200
|
||||
},
|
||||
"ambience": "Escaping the Grave.ogg",
|
||||
"footstep_sound": "footstep_stone"
|
||||
}
|
||||
|
@@ -174,5 +174,6 @@
|
||||
"left": 0,
|
||||
"right": 200
|
||||
},
|
||||
"ambience": "Graveyard Blitz.ogg",
|
||||
"footstep_sound": "footstep_tall_grass"
|
||||
}
|
||||
|
@@ -248,5 +248,6 @@
|
||||
"left": 0,
|
||||
"right": 200
|
||||
},
|
||||
"ambience": "Wayward Ghouls.ogg",
|
||||
"footstep_sound": "footstep_tall_grass"
|
||||
}
|
||||
|
@@ -203,5 +203,6 @@
|
||||
"left": 0,
|
||||
"right": 200
|
||||
},
|
||||
"ambience": "Choir of Doom.ogg",
|
||||
"footstep_sound": "footstep_stone"
|
||||
}
|
||||
|
@@ -187,5 +187,6 @@
|
||||
"left": 0,
|
||||
"right": 200
|
||||
},
|
||||
"ambience": "Choir of Doom.ogg",
|
||||
"footstep_sound": "footstep_stone"
|
||||
}
|
||||
|
@@ -190,5 +190,6 @@
|
||||
"left": 0,
|
||||
"right": 200
|
||||
},
|
||||
"ambience": "Escaping the Grave.ogg",
|
||||
"footstep_sound": "footstep_tall_grass"
|
||||
}
|
||||
|
@@ -271,5 +271,6 @@
|
||||
"left": 0,
|
||||
"right": 250
|
||||
},
|
||||
"ambience": "Spider's Domain.ogg",
|
||||
"footstep_sound": "footstep_tall_grass"
|
||||
}
|
||||
|
BIN
sounds/ambience/Spider's Domain.ogg
(Stored with Git LFS)
Normal file
BIN
sounds/ambience/Spider's Domain.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
sounds/ambience/Wayward Ghouls.ogg
(Stored with Git LFS)
Normal file
BIN
sounds/ambience/Wayward Ghouls.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
16
src/level.py
16
src/level.py
@@ -34,6 +34,22 @@ class Level:
|
||||
# Pass footstep sound to player
|
||||
self.player.set_footstep_sound(self.footstepSound)
|
||||
|
||||
# Level intro message
|
||||
levelIntro = f"Level {levelData['level_id']}, {levelData['name']}. {levelData['description']}"
|
||||
messagebox(levelIntro)
|
||||
|
||||
# Handle level music
|
||||
try:
|
||||
pygame.mixer.music.stop()
|
||||
if "ambience" in levelData:
|
||||
try:
|
||||
pygame.mixer.music.load(f"sounds/ambience/{levelData['ambience']}")
|
||||
pygame.mixer.music.play(-1) # Loop indefinitely
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
|
||||
# Create end of level object at right boundary
|
||||
endLevel = Object(
|
||||
self.rightBoundary,
|
||||
|
@@ -177,6 +177,11 @@ class Player:
|
||||
self._lives -= 1
|
||||
# Stop all current sounds before playing death sound
|
||||
pygame.mixer.stop()
|
||||
try:
|
||||
pygame.mixer.music.stop()
|
||||
except:
|
||||
pass
|
||||
|
||||
cut_scene(self.sounds, 'lose_a_life')
|
||||
|
||||
def set_max_health(self, value):
|
||||
|
@@ -33,7 +33,8 @@ class WickedQuest:
|
||||
levelData["player_start"]["y"],
|
||||
self.sounds)
|
||||
else:
|
||||
# Just update player position for new level
|
||||
# Reset player for new level.
|
||||
self.player.isDucking = False
|
||||
self.player.xPos = levelData["player_start"]["x"]
|
||||
self.player.yPos = levelData["player_start"]["y"]
|
||||
|
||||
@@ -41,10 +42,6 @@ class WickedQuest:
|
||||
pygame.event.pump()
|
||||
self.currentLevel = Level(levelData, self.sounds, self.player)
|
||||
|
||||
# Announce level details
|
||||
levelIntro = f"Level {levelData['level_id']}, {levelData['name']}. {levelData['description']}"
|
||||
messagebox(levelIntro)
|
||||
|
||||
return True
|
||||
except FileNotFoundError:
|
||||
speak("Level not found")
|
||||
@@ -141,7 +138,13 @@ class WickedQuest:
|
||||
if key != 'Total time': # Skip time since we already displayed it
|
||||
report.append(f"{key}: {self.currentLevel.player.stats.get_level_stat(key)}")
|
||||
|
||||
# Stop all sounds and music
|
||||
pygame.mixer.stop()
|
||||
try:
|
||||
pygame.mixer.music.stop()
|
||||
except:
|
||||
pass
|
||||
|
||||
display_text(report)
|
||||
self.currentLevel.player.stats.reset_level()
|
||||
|
||||
@@ -179,6 +182,10 @@ class WickedQuest:
|
||||
altPressed = mods & pygame.KMOD_ALT
|
||||
|
||||
if event.key == pygame.K_ESCAPE:
|
||||
try:
|
||||
pygame.mixer.music.stop()
|
||||
except:
|
||||
pass
|
||||
return
|
||||
# Volume controls (require Alt)
|
||||
elif altPressed:
|
||||
@@ -232,7 +239,9 @@ class WickedQuest:
|
||||
else:
|
||||
# Game complete - use gameStartTime for total
|
||||
totalTime = pygame.time.get_ticks() - self.gameStartTime
|
||||
if self.player.xPos >= self.currentLevel.rightBoundary:
|
||||
messagebox("Congratulations! You've completed all available levels!")
|
||||
|
||||
self.display_game_over(totalTime)
|
||||
return
|
||||
|
||||
@@ -240,6 +249,12 @@ class WickedQuest:
|
||||
|
||||
def run(self):
|
||||
"""Main game loop with menu system."""
|
||||
# make sure no music is playing when the menu loads.
|
||||
try:
|
||||
pygame.mixer.music.stop()
|
||||
except:
|
||||
pass
|
||||
|
||||
while True:
|
||||
choice = game_menu(self.sounds, "play", "instructions", "learn_sounds",
|
||||
"credits", "donate", "exit")
|
||||
|
Reference in New Issue
Block a user