Wait for sound to finish before playing it again

Hi

Is there a simple way to have a sound attached to a button that will only play once before it can play again?

Cheers
:confused:

Is it as simple as setting a boolean or variable when you play the sound that you check every time you press the button?
Such as IsPlaying or something like that?

When you click the button, play the sound on a channel and then you can use the condition to check if sound is playing on a channel. Invert the condition to check if sound is NOT playing on the channel then play the sound.

So the logic is:

Condition:
If Left mouse button is down or touch held
If the pointer is over the button sprite
If sound is NOT playing on channel 1

Action:
Play sound on channel 1

This way the sound is going to be played only once when the button is clicked and only if no sound is playing already on the channel. Basically, you can dedicate a channel to the button.

1 Like

Thank you. Great explanation. :smiley: