The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

So in short I have a scene with background music and five buttons. Each time a button is pressed, a looping sound plays on top of the background music (one different looping sound per button).

How would I go about making it so each time a button is pressed, the looping sound of the previous one is muted and the new one is unmuted (while the background music keeps playing as normal)I tried doing something with different buses but I can't quite figure it out. I believe the answer is pretty simple but I can't quite grasp it. Thanks in advance.

in Engine by (16 points)

2 Answers

+1 vote

A solution would be to have a node for each sfx and make some checks like, if Audio.playing() == true, then Audio.stop(), for all the nodes that you dont want to play. another aproach would be to have only one node for sfx, and load and play a sound when you want to, like = soundyouwant and then

by (450 points)

Thanks but is there a way to mute the audio instead of stopping it? (so it keeps playing even if its muted)

+1 vote

Godot has audio buses (which are like audio channels). so you can just assign the background music to a bus and the game sounds to another, and just mute the game sounds bus.

Godot has a documentation page for audio buses

by (32 points)
reshown by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.