How do I select a random sound with the right info

Get help using Construct 2

Post » Tue Feb 24, 2015 10:17 am

Hi Yall,

I'm having a little issue here.

My situation is the following:
- I have sounds named:
- Animal1
- Animal2
- Animal3 etc..

Once going to a layout it has pick one of the sounds listed above.

There is a button you can click to play that sound.

Once the sound is over it has to be saved in a Webstorage so we know that the sound is played before. As far as my concern i think i would have to save it as:
Webstorage > Set local value "Animal1" = 1.

So it should:
Start of layout > Select sound ( between animal1, animal2, animal3 ) where Webstorage "animal1/animal2/animal3" = 0
"for this example sound 2 ( animal2 ) is selected"
Click on button > Selected sound will play
On sound ended > Set webstorage "animal2" = 1

So the next time it should be:
Start of layout > Select sound ( between animal1, animal3 ) where Webstorage "animal1/animal3" = 0
"as you see sound 2 is done and will never be selected again"

The point that i can't fix is selecting the sound on random order, but only if the webstorage for that sound is "0".

Any help in the right direction would be lovely!

Thanks in advance!
Posts: 181
Reputation: 2,551

Return to How do I....?

Who is online

Users browsing this forum: burak22, fbarraza28, kelany and 2 guests