Skip to content
This repository has been archived by the owner on Feb 18, 2025. It is now read-only.

Commit

Permalink
Update settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Virashu committed Feb 11, 2024
1 parent b85747e commit 392a59c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion danmaku/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
set_saved_objects,
set_saved_game,
delete_saved_objects,
get_settings,
)
from danmaku.pause import Pause
from danmaku.background import Background
Expand Down Expand Up @@ -80,8 +81,10 @@ class Game(vgame.Scene):
def load(self):
self.graphics.library.path = resource_path("textures")

self.settings = get_settings()

pygame.mixer.init()
pygame.mixer.music.set_volume(0.5)
pygame.mixer.music.set_volume(self.settings["music_volume"]["value"] / 100)
pygame.mixer.music.load(resource_path("sounds/bgm.wav"))
pygame.mixer.music.play(loops=-1)

Expand Down Expand Up @@ -243,6 +246,7 @@ def update_game(self):
set_saved_game(self.cur_level, self.player.score, self.player.power)
self.exit_status = "lose"
death_sfx = pygame.mixer.Sound(resource_path("sounds/death.wav"))
death_sfx.set_volume(self.settings["sfx_volume"]["value"] / 100)
channel = death_sfx.play()
while channel.get_busy():
pygame.time.wait(10)
Expand Down

0 comments on commit 392a59c

Please sign in to comment.