I have 4 buttons on the main menu. When a button is tapped a sound plays, a black background fades in and you are taken to the corresponding layout.
The problem is, during the fade in of the black background you can click on any of the buttons and the sound can still play.
I've been looking for the longest time for a solution on how to stop the sound from playing when any button is tapped. I've tried things like:
Add an Audio is tag playing condition to the button clicked event and invert it..
...make a global variable that tracks if the button was clicked, where on its first click, it'll set it to 1 and allow a song to play, but if you click again, it is set to 2 and won't play.
"On button clicked -> Sys: Add 1 to variable -> | if variable = 1 -> play sound"
Take your button sprite and create boolean variable. Name it something like "Is_Playing". Now events:
On BUTTON clicked
- Is_Playing : Stop, toggle boolean "Is_Playing"
- Else : Play, toggle boolean "Is_Playing"
I guess i'm just not C2 savy enough to understand why any of these just won't work.
If anyone can help explain things, i'd be very grateful.