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