Play Random sounds?

Get help using Construct 2

Post » Mon Jan 02, 2012 12:04 am

For example each time an event happens play a random sound from a list or folder. Can this be done?lonrot2012-01-02 03:52:52
B
4
S
1
G
1
Posts: 53
Reputation: 858

Post » Mon Jan 02, 2012 8:05 am

Ooops wrong forum.siron2012-01-02 08:06:25
B
14
S
2
G
1
Posts: 28
Reputation: 1,152

Post » Mon Jan 02, 2012 8:54 am

Sure....put the name of the soundfiles in an array, so they are mapped to numbers and then use the random statement to select one of the array cells.
B
44
S
24
G
13
Posts: 723
Reputation: 15,015

Post » Mon Jan 02, 2012 8:59 am

or use the choose() function
[code]Audio: Play choose("bird","duck","cat","tiger") from Sounds (tag "animal")[/code]
B
68
S
22
G
14
Posts: 1,485
Reputation: 16,561

Post » Mon Jan 02, 2012 9:07 am

you again
B
44
S
24
G
13
Posts: 723
Reputation: 15,015

Post » Tue Jan 03, 2012 6:25 am

Great one Yann, Choose is super easy to use. I took a bit to realize where to place it (works fine under Audio File Name, Play(by name))

B
4
S
1
G
1
Posts: 53
Reputation: 858

Post » Mon Feb 18, 2013 8:19 pm

Excellent!
B
8
S
3
G
2
Posts: 49
Reputation: 1,943

Post » Tue Sep 03, 2013 2:52 pm

Yann > I love you !! help a lot! EVER!

Thanks!
B
24
S
2
G
5
Posts: 49
Reputation: 4,882

Post » Tue Sep 03, 2013 4:09 pm

oh, awesome =P been wondering how to do this for some time now.
B
43
S
12
G
6
Posts: 446
Reputation: 6,807

Post » Thu Aug 21, 2014 11:23 am

Is there an example with the array?
I dont want to manually write in 100 small sounds filenames in Choose..
B
37
S
9
G
8
Posts: 541
Reputation: 8,554

Next

Return to How do I....?

Who is online

Users browsing this forum: irina, luckyrawatlucky and 7 guests