How do I preload and random audio

Get help using Construct 2

Post » Sun Apr 20, 2014 4:34 pm

to preload multiply audio files:
Preload (by name): "explosion1"&"explosion2"&"explosion3"&"explosion4"
is that right?

and how do i play this sounds randomly?
B
20
S
4
Posts: 385
Reputation: 2,270

Post » Sun Apr 20, 2014 4:43 pm

No. You are trying to preload a sound called "explosion1explosion2explosion3explosion4".

Just load each individually.

To play: Play by name: "explosion"&int(random(1,5))
ImageImageImage
B
71
S
21
G
229
Posts: 3,686
Reputation: 128,336

Post » Sun Apr 20, 2014 5:00 pm

blackhornet wrote:No. You are trying to preload a sound called "explosion1explosion2explosion3explosion4".

Just load each individually.

To play: Play by name: "explosion"&int(random(1,5))


oh, i get it :)
but what about the 'choose' to play random sounds? works fine?
B
20
S
4
Posts: 385
Reputation: 2,270

Post » Sun Apr 20, 2014 5:15 pm

'choose' would also work.
ImageImageImage
B
71
S
21
G
229
Posts: 3,686
Reputation: 128,336

Post » Sun Apr 20, 2014 6:21 pm

blackhornet wrote:'choose' would also work.

what's the best way to use preload?
with 'on start of layout'?
B
20
S
4
Posts: 385
Reputation: 2,270

Post » Sun Apr 20, 2014 9:58 pm

Yes, then wait for 'All preloads complete' with a 'Trigger once' to toggle a variable that flags that the sounds can be played (if that is relevant).
ImageImageImage
B
71
S
21
G
229
Posts: 3,686
Reputation: 128,336

Post » Sun Apr 20, 2014 10:25 pm

blackhornet wrote:Yes, then wait for 'All preloads complete' with a 'Trigger once' to toggle a variable that flags that the sounds can be played (if that is relevant).

great :)
tnks
B
20
S
4
Posts: 385
Reputation: 2,270


Return to How do I....?

Who is online

Users browsing this forum: Laura_D, plinkie and 21 guests