Sounds

Talk about making games.

Sounds

Postby duracel92 » Sat Mar 25, 2006 7:39 pm

I'm not very good at scripting or code or even the simple codes that you get...

I have a sound playing and when it goes out of view I want it to stop. I know I need to use the stop sound feature but I doesn't work, Generally giving the error "undeclared identifier (name of sound)".. How can I fix this?
duracel92
 
Posts: 132
Joined: Sat Jan 21, 2006 10:45 pm
Location: UK
Score: 0 Give a positive score

Postby The achievement » Sat Mar 25, 2006 11:19 pm

i would suggest making 2 actors, make one actor just floating in the air, and if you hit it, it plays the sound. then make another actor and make a collision and all that lovely stuff and use script editor and use a event diasable action.

If you have any problems keep on asking! :D
User avatar
The achievement
 
Posts: 220
Joined: Sun Feb 12, 2006 11:01 pm
Location: United States,Massachusetts
Score: 0 Give a positive score

Postby duracel92 » Sat Mar 25, 2006 11:38 pm

its ok.. lol its the script to stop the sound is what i need...
duracel92
 
Posts: 132
Joined: Sat Jan 21, 2006 10:45 pm
Location: UK
Score: 0 Give a positive score

Postby DilloDude » Sat Apr 01, 2006 11:07 am

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.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest