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
G
1
Posts: 53
Reputation: 708

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
42
S
19
G
12
Posts: 723
Reputation: 13,911

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
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Mon Jan 02, 2012 9:07 am

you again
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

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
G
1
Posts: 53
Reputation: 708

Post » Mon Feb 18, 2013 8:19 pm

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

Post » Tue Sep 03, 2013 2:52 pm

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

Thanks!
B
22
S
2
G
5
Posts: 49
Reputation: 4,827

Post » Tue Sep 03, 2013 4:09 pm

oh, awesome =P been wondering how to do this for some time now.
B
42
S
11
G
5
Posts: 446
Reputation: 6,417

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
34
S
8
G
7
Posts: 498
Reputation: 7,753

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests