How do I select a random sound with the right info

0 favourites
  • 1 posts
From the Asset Store
A set of retro 16-Bit Neon UI elements to make your menus pop!
  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)