Create an integer variable: chan(or any name you want)
now, in your playsound code,
- Code: Select all
chan=PlaySound2("data/sound", 1, 1, 0);
or whatever the playsound function uses. Using chan=PlaySound2 assigns the channel variable to that sound, or something like that. Now to stop the sound:
- Code: Select all
stopSound(chan);
Just a note on the subject of sounds- tha pan value: this is the value for which speakers to play the sound from-left or right- and how much to play from each speaker. Now, normally this is set manually, but I have developed a function to return a variable based on the actor's xscreen coordinates. So then, in the playsound:
- Code: Select all
PlaySound2("data/sound", 1, 1, Bal()));
I can post it later if anyone is interested.