Character sound effect playing

Started by Mats Berglinn, Thu 05/05/2005 11:24:02

Previous topic - Next topic

Mats Berglinn

I've recently started on a Star Wars parody for this month MAGS and I've stumbled on a little problem. One of the characters is a Darth Vader spin-off called Dark Waker and I want the character to breath everytime he is around (the sound of the hissing Darth Vader breath). I have a sound for the breathing but I don't know how to script that everytime Dark Waker is around you hear the breathing. Does anyone know how to tackle this problem?

Ashen

A couple of ways come to mind, most basicaly:
Code: ags

//in rep_ex
if (character[WAKER].room == character[EGO].room) {
  if (IsSoundPlaying()==0) PlaySound(BREATH);
}


You could also add checks to the character's coords, so it only plays when they're within a certain distance of each other. You could use an int or GlobalInt to check if the sound has started, rather than IsSoundPlaying(). You could use PlayAmbientSound() so it loops automaticly, and gets louder the closer the player is to Waker. If you use PlaySoundEx () instead of PlaySound(), you can use IsChannelPlaying (), which would be a bit more specific than IsSoundPlaying().

It depends on how exactly you want the sound to behave.
I know what you're thinking ... Don't think that.

Mats Berglinn


SMF spam blocked by CleanTalk