sound.py 638 B

12345678910111213141516
  1. import pygame as pg
  2. class Sound:
  3. def __init__(self, game):
  4. self.game = game
  5. pg.mixer.init()
  6. self.path = 'resources/sound/'
  7. self.shotgun = pg.mixer.Sound(self.path + 'shotgun.wav')
  8. self.npc_pain = pg.mixer.Sound(self.path + 'npc_pain.wav')
  9. self.npc_death = pg.mixer.Sound(self.path + 'npc_death.wav')
  10. self.npc_shot = pg.mixer.Sound(self.path + 'npc_attack.wav')
  11. self.npc_shot.set_volume(0.2)
  12. self.player_pain = pg.mixer.Sound(self.path + 'player_pain.wav')
  13. self.theme = pg.mixer.music.load(self.path + 'theme.mp3')
  14. pg.mixer.music.set_volume(0.3)