Generate a random sound on a touch press

Hey everyone,

It's my first post here so I may be a little naive. :) I'm making a small app where the core mechanics are that when you press on a character's face, one of 16 morale-boosting phrases plays. I want it to be random so the longevity of the app's usefulness is extended.

So what I'd be looking to do is set up a game attribute and then establish that only 16 sounds will play and then reset it back to 0 after the touch is pressed so that the cycle can begin again. How would I go about that?

Thanks

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Hi, what you'll need to do is something like this:

    first pick the random number by setting up an Attribute, I'll call it sound.

    Change Attribute -- sound -- random (1,16) <-- This will pick a random number between 1 and 16.


    Then set up 16 Rules like this:

    If sound = 1 -- play sound 1

    If sound = 2 -- play sound 2

    etc., etc.

    Kind of a pain, but that's the best way to handle it now I believe.
  • MasakoXMasakoX Member Posts: 16
    I came to the conclusion too. It may be cumbersome but it's solid. Thank you!
Sign In or Register to comment.