Playing sounds randomly

andrewhnovak@gmail.comandrewhnovak@gmail.com Member, PRO Posts: 77
edited March 2014 in Working with GS (PC)

I'm building an endless runner and I have a missile that comes across the screen and two different sound effects. How can I play one sound or the other randomly. So it switches off randomly?

Comments

  • BenMakesGamesBenMakesGames Member Posts: 85

    You could do it with a random number and an rule.

    The Rule would be similar to.

    If Random(1,2) = 1;

    Play sound.A.

    Else

    Play sound B

  • andrewhnovak@gmail.comandrewhnovak@gmail.com Member, PRO Posts: 77

    I followed your instruction to the best of my ability, but it only plays one of the two sounds. Can you tell me what I did wrong. Here's a screenshot
    http://postimg.org/image/565yfhey1/

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    You posted a screenshot of the instance's rules. If you're spawning the missile actor, you need to revert to prototype and double-check that they prototype rules are the same as what you posted.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • andrewhnovak@gmail.comandrewhnovak@gmail.com Member, PRO Posts: 77

    I added the same thing to the prototype like you said but what I type "If Random(1,2) = 1;" where it says "type or drag in a condition" it disappears when I jump between tabs.(prototype missile and instance missile) and it just stays blank????? How can I make the condition stay and why does it keep disappearing what I type?

    http://postimg.org/image/fwysf00gl/

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I'm not sure why that's happening but try clicking the Revert to Prototype button (shown at the very left edge of your screenshot).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.