2016-03-19 00:20:19

Hello,
I have always wondered how to cue sounds in bgt. For example to play a corpse sound just after the death sound is finished.
Can you please tell me a way to do that? Thanks.

I post sounds I record to freesound. Click here to visit my freesound page
I usually post game recordings to anyaudio. Click here to visit my anyaudio page

2016-03-19 01:37:02

I've solved this by using timer which holds the length of the sound file. Example:
if(sound_timer.elapsed>=my_sound_file.length)
{
sound_timer..restart();
my_sound_file.stop();
next_sound_file.load("somefile.ogg");
next_sound_file.play();
}
HTH

2016-03-19 02:03:53

Hello,
Thank you, I will try this

I post sounds I record to freesound. Click here to visit my freesound page
I usually post game recordings to anyaudio. Click here to visit my anyaudio page

2016-03-19 05:11:33

Are you using the sound pool, or sound objects?
There are several ways, depending on how your code is arranged.
I'd probably do something like give the enemy/player/etc either a handle to their currently-playing sound, or the number of the slot in the sound_pool, then check when it's done playing like so:
if(handle.playing==false)
or
if(pool.sound_is_playing(slot)==false)
For the sound_pool, you'd need to make the sound persistent, then destroy it when it's done playing.

If you want to queue arbitrary sounds without doing state-based things for each case (for example, if you want to have the music play different tracks, rather than loop the same BGM), you'd probably want to use an array.
Something like:

if(handle.playing==false and queue.length()>0)
{
handle.load(queue[0]);
handle.play();
queue.remove_at(0);
}

HTH

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.