Allow for custom footsteps. Some work on footsteps to make the sound less crazy. Various other updates. Added initial documentation and credits files.

This commit is contained in:
Storm Dragon
2025-02-05 02:04:57 -05:00
parent 883dafaac0
commit c29bcd40b7
17 changed files with 431 additions and 43 deletions

View File

@@ -65,6 +65,14 @@ class WickedQuest:
player.xPos += currentSpeed
player.facingRight = True
# Handle footsteps
if movementDistance > 0 and not player.isJumping:
player.distanceSinceLastStep += movementDistance
if player.should_play_footstep(currentTime):
play_sound(self.sounds[player.footstepSound])
player.distanceSinceLastStep = 0
player.lastStepTime = currentTime
# Status queries
if keys[pygame.K_c]:
speak(f"{player.get_coins()} gbone dust")
@@ -84,13 +92,6 @@ class WickedQuest:
if (keys[pygame.K_LCTRL] or keys[pygame.K_RCTRL]) and player.start_attack(currentTime):
play_sound(self.sounds[player.currentWeapon.attackSound])
# Play footstep sounds if moving and not jumping
if movementDistance > 0 and not player.isJumping:
player.distanceSinceLastStep += movementDistance
if player.distanceSinceLastStep >= player.stepDistance:
play_sound(self.sounds['footstep'])
player.distanceSinceLastStep = 0
# Handle jumping
if keys[pygame.K_w] and not player.isJumping:
player.isJumping = True
@@ -100,9 +101,10 @@ class WickedQuest:
# Check if jump should end
if player.isJumping and currentTime - player.jumpStartTime >= player.jumpDuration:
player.isJumping = False
play_sound(self.sounds['footstep'])
play_sound(self.sounds[player.footstepSound]) # Landing sound
# Reset step distance tracking after landing
player.distanceSinceLastStep = 0
player.lastStepTime = currentTime
def display_level_stats(self, timeTaken):
"""Display level completion statistics."""
@@ -214,6 +216,8 @@ class WickedQuest:
self.player = None # Reset player for new game
if self.load_level(1):
self.game_loop()
elif choice == "learn_sounds":
choice = learn_sounds(self.sounds)
if __name__ == "__main__":