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
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.
You can put your On touched events in a Group (like Menu Buttons) and Deactivate the group when any button is pressed. This will block any more button events until you Activate the group again.
Develop games in your browser. Powerful, performant & highly capable.
Oh you are so awesome!
That was too easy. Learn something new everyday.
Thank you again.