Randomizing Audio (Background/Objects)

0 favourites
  • 8 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • New question! I want to randomize my background audio while the game is running. IE When one track finishes another track starts, randomly chosen from a list.

    I also want to randomize the audio when an object is destroyed!

    Now, the only thing I am thinking of is using families for this? Is that even possible? (I do have a personal license)

  • use choose

  • You could just use the same tag for all of your backing audio, then when any audio with that tag ends, have it begin a new song selected at random.

    ie.

    On audio ended, tag = "bgmusic"

            if random(0,20) >= 10

                  play audio "track1" tag="bgmusic"

            else

                  play audio "track2" tag="bgmusic"

    then you can just keep adding to the list for each audio track that you have.

  • use choose

    So something like:

    <img src="http://i.imgur.com/Gglb65v.png" border="0" />

  • use play by name event, then in the name set it to choose("bgm1","bgm2","bgm3")

  • I think California was trying to say you could do something like this:

    Play by Name

    • choose("BGM1","BGM2")

    Your method also works though. :D

  • Stomphoof Yep, just set the tag in each of your play audio actions. Then make your condition check to see if that tag has stopped playing.

    You might want to make the "test >= 0" when into an else though, because right now it will always play BGM1 since test is always greater than or equal to 0.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Stomphoof Yep, just set the tag in each of your play audio actions. Then make your condition check to see if that tag has stopped playing.

    You might want to make the "test >= 0" when into an else though, because right now it will always play BGM1 since test is always greater than or equal to 0.

    That was more about the actual events then the conditions of em. I was just stuffing numbers in places haha

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)