Extra life added, fixed sounds to use the new functions for volume control Other various improvements.
This commit is contained in:
		| @@ -67,7 +67,7 @@ class WickedQuest: | ||||
|          | ||||
|         # Status queries | ||||
|         if keys[pygame.K_c]: | ||||
|             speak(f"{player.get_coins()} coins") | ||||
|             speak(f"{player.get_coins()} gbone dust") | ||||
|         if keys[pygame.K_h]: | ||||
|             speak(f"{player.get_health()} HP") | ||||
|         if keys[pygame.K_l]: | ||||
| @@ -82,25 +82,25 @@ class WickedQuest: | ||||
|  | ||||
|         # Handle attack with either CTRL key | ||||
|         if (keys[pygame.K_LCTRL] or keys[pygame.K_RCTRL]) and player.start_attack(currentTime): | ||||
|             self.sounds[player.currentWeapon.attackSound].play() | ||||
|             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: | ||||
|                 self.sounds['footstep'].play() | ||||
|                 play_sound(self.sounds['footstep']) | ||||
|                 player.distanceSinceLastStep = 0 | ||||
|  | ||||
|         # Handle jumping | ||||
|         if keys[pygame.K_w] and not player.isJumping: | ||||
|             player.isJumping = True | ||||
|             player.jumpStartTime = currentTime | ||||
|             self.sounds['jump'].play() | ||||
|             play_sound(self.sounds['jump']) | ||||
|      | ||||
|         # Check if jump should end | ||||
|         if player.isJumping and currentTime - player.jumpStartTime >= player.jumpDuration: | ||||
|             player.isJumping = False | ||||
|             self.sounds['footstep'].play() | ||||
|             play_sound(self.sounds['footstep']) | ||||
|             # Reset step distance tracking after landing | ||||
|             player.distanceSinceLastStep = 0 | ||||
|  | ||||
| @@ -149,9 +149,24 @@ class WickedQuest: | ||||
|         while True: | ||||
|             currentTime = pygame.time.get_ticks() | ||||
|      | ||||
|             if check_for_exit(): | ||||
|                 return | ||||
|          | ||||
|             # Game volume controls | ||||
|             for event in pygame.event.get(): | ||||
|                 if event.type == pygame.KEYDOWN: | ||||
|                     if event.key == pygame.K_ESCAPE: | ||||
|                         return | ||||
|                     if event.key == pygame.K_PAGEUP: | ||||
|                         adjust_master_volume(0.1) | ||||
|                     elif event.key == pygame.K_PAGEDOWN: | ||||
|                         adjust_master_volume(-0.1) | ||||
|                     elif event.key == pygame.K_HOME: | ||||
|                         adjust_bgm_volume(0.1) | ||||
|                     elif event.key == pygame.K_END: | ||||
|                         adjust_bgm_volume(-0.1) | ||||
|                     elif event.key == pygame.K_INSERT: | ||||
|                         adjust_sfx_volume(0.1) | ||||
|                     elif event.key == pygame.K_DELETE: | ||||
|                         adjust_sfx_volume(-0.1) | ||||
|  | ||||
|             # Update game state | ||||
|             self.currentLevel.player.update(currentTime) | ||||
|             self.handle_input() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user