Hi Everybody!
Is there any way to set the amount of times you can play a sound?
Cheers!
P.s. Need more actions with sound!
what exactly do you mean with amount of times?
Hmmm you can always set a timer (global/instance variable) when you play a sound, you increment it and when this timer variable reach a specific value you stop the sound. (But you should preload it first to be sure it's as sync as it can be)
Global number timer = 0 +On what you want -> Audio: Stop sound tag "mySound" // to stop the sound if you don't want two sounds playing at the same time -> Audio: Play sound tag "mySound" -> System: set timer to 5 +System: Every tick -> System: set timer to max(timer-dt,0) +System: timer = 0 -> Audio: Stop sound tag "mySound"
Should work
for example:
You press a button, an action begins with sound. Then you cant play the sound again till all other actions have taken place.
Yann
I will give that ago!
Its not working for me, can you show me an image of what it will look like in the engine?
send me a simple .capx with what you managed copy from my solution
so you are trying to play a sound twice or even more at the same time?
Weishaupt
I have a button, you press the button, it plays the sound and something happens next.
I don't want to be able to play the sound again until the rest of the scripts have finished doing what they are doing.
Test
Ok, now I understand. thx!
You can allways check if the sound is still playing and if so, not start it again
Sweet! :)
Develop games in your browser. Powerful, performant & highly capable.
Just use
on ended
and invert it...
I've tried that and it doesn't' work. There's not many options with sound.
Weishaupt Never invert Triggers
2Bdigital
works fine for me soundTiming.capx
Cheers Yann!!!!!
Got it working :)