Page 1 of 1

sound effects

PostPosted: Wed May 14, 2008 11:49 pm
by bkelynch
How do you play a random sound from a set of sounds when an actor gets hit?

Re: sound effects

PostPosted: Thu May 15, 2008 2:10 am
by DST
make an integer variable. here i've made one called 'soundchoose'.
an actor>collision:
Code: Select all
soundchoose = random(3);
switch (soundchoose){
case 0:
PlaySound("data/sound.wav", 1, 1, 1);
break;
case 1:
PlaySound("data/sound2.wav", 1, 1, 1);
break:
case 2:
PlaySound("data/sound3.wav", 1, 1, 1);
break;
}