How do I Play Random Audio

Get help using Construct 2

Post » Tue Sep 26, 2017 4:42 pm

how can play random Audio ?
B
3
Posts: 8
Reputation: 191

Post » Tue Sep 26, 2017 6:37 pm

how random must it be?

you can do int(random(1,5)) or use choose(1,2,3,4,5,6,7) , then convert the number in a string text and play from sounds/music folder and you place str(yourvalue) in there.

then you need to build on the number picked what audio you want to play, or have the files named like that and tell the audio to play that file using the set source i think expression or play from folder... been a while since i used it. there's different approaches let me see what i can do in 2 minutes.

Edited: @yiuyiu6666 i think 2 minutes past ... my bad if was more than 2 here is a random audio capx
B
78
S
23
G
69
Posts: 1,354
Reputation: 44,027

Post » Wed Sep 27, 2017 2:14 pm

I believe you can also just put the filename in the choose statement and "play by name" audio filename = choose("bell1","bell2","bell3")" and it will play the file directly.

Just have those files added to the project. I am using that in a event currently.

-fitz
B
8
S
1
G
1
Posts: 1
Reputation: 1,102


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 37 guests