1import pygame, os
2pygame.mixer.init()
3
4class Sound_Handler:
5
6 sounds = {}
7
8 def __init__(self, game):
9 self.game = game
10
11 def load_sound(self, sound_id, sound_file):
12 self.sounds[sound_id] = {
13 "file": pygame.mixer.Sound(os.path.join("src", "resources", self.game.current_assetpack, "assets", "sounds", sound_file + ".ogg"))
14 }
15
16 def play_sound(self, sound_id):
17 self.sounds[sound_id]["file"].play()