I'm working on fully fleshing out a game I made following a tutorial, and have been trying to incorporate sound effects into the finished thing. However they are way too loud and I can't seem to find a way to quieten them. I know there's a way in normal pygame but I don't know if there's one for pgzero. Any help would be greatly appreciated :)
Here's a snippet of code in case that helps:
if gem.colliderect(ship):
sounds.gem_collect.play()
gem.x = random.randint(20, 1180)
gem.y = 0
score = score + 1
I have never used pygame zero. But here is the documentation. Doesn't say anything about setting volume for sound objects, but you can set_volume()
for music:
music.set_volume(volume)
Set the volume of the music system. This takes a number between 0 (meaning silent) and 1 (meaning full volume).
You could try to use the set_volume()
method on a sound object and see what happens. Maybe it's just not documented well.
if gem.colliderect(ship):
sounds.gem_collect.set_volume(0.2)
sounds.gem_collect.play()
gem.x = random.randint(20, 1180)
gem.y = 0
score = score + 1