Removed music duplicates

This commit is contained in:
theo@manjaro 2021-11-27 19:27:14 +01:00
parent 41ab3722fc
commit a7a147f65d
7 changed files with 4 additions and 7 deletions

View File

@ -36,7 +36,6 @@ class Game():
mapdico["backgrounds"] = []
mapdico["data"] = None
mapdico["filler"] = None
mapdico["bgm"] = None
mapdico["tilesets"] = {}
scanner = os.scandir(path=mapfolder)
for i in scanner: # Je check tout les fichiers du dossier
@ -51,10 +50,6 @@ class Game():
mapdico["filler"] = pygame.image.load(i.path).convert_alpha()
else:
mapdico["tilesets"][i.name] = pygame.image.load(i.path).convert_alpha()
if len(name)==7:
if name.startswith("bgm"):
if name.endswith(".wav") or name.endswith(".ogg") or name.endswith(".mp3"):
mapdico["bgm"] = pygame.mixer.Sound(i.path)
except:
self.log("Erreur",mapfolder,name,"Fichier invalide")
if name=="map.json":
@ -97,6 +92,7 @@ class Game():
self.globals["completedlevels"] = [] # Levels where the player kicked all non-respawnable ennemies
self.globals["speedrunlevels"] = [] # Levels where the player finished fast enough
self.globals["allunlocked"] = True
self.globals["bgms"] = ["city.ogg","docks.ogg","isle.ogg","isle.ogg","docks.ogg","city.ogg"]
self.init_inputs()
self.scaleCamera()

Binary file not shown.

Binary file not shown.

View File

@ -80,9 +80,10 @@ class TilesetRenderer(BaseObject):
self.spikes = []
self.layers = []
self.spawns = []
self.bgm = level["bgm"]
self.bgm = None
if "levelname" in self.game.globals.keys():
self.bgm = self.game.sound_lib["bgm/"+self.game.globals["bgms"][self.game.globals["levelname"]]]
if self.bgm:
self.bgm.set_volume(self.game.globals["bgmvolume"])
self.bgm.play(-1)
spawnlists = {"Spawns":self.spawns}
ennemies = {"Robot":Robot,"Crate":Crate,"Balloon":Balloon,"Spring":Spring,"WaterChange":WaterChange,"Levels":Levels,"End":EndFlag,"TrashBag":TrashBag,"Ripple":Ripple,"Squid":Squid,"Shooter":Shooter}