Makkeonmies
Member
In my 2d strategy game i use a lot of 3d sounds using emitters, and they work just fine. Mostly, it means an object plays a sound once, or an object plays a sound and is then destroyed. Often my code is as follows,
Create:
emitter_id = audio_emitter_create();
audio_play_sound_on(emitter_id,heavywind,true,1);
Step:
audio_emitter_position(emitter_id,x,y,0);
Destroy:
audio_emitter_free(emitter_id);
However, i'd like to have some sounds continuous that for example the player's units make, like horses galloping, but I can't make the 3d sounds pause when the unit stops and continue again when it moves. The sound never stops when the character does, and it just keeps stacking the sound when the character resumes movement...
Create:
emitter_id = audio_emitter_create();
Step:
audio_emitter_position(emitter_id,x,y,0);
if speed > 0
{
emitter_id = audio_emitter_create(); //to recreate the sound when unit is moving
audio_play_sound_on(emitter_id,gallop,0,1)
}
if speed = 0
{
audio_emitter_free(emitter_id);
}
Any clues what im doing wrong here?
P.s. can someone tip me how to put these codes into the form everyone prefers on the forums here...
Thanks beforehand!
Create:
emitter_id = audio_emitter_create();
audio_play_sound_on(emitter_id,heavywind,true,1);
Step:
audio_emitter_position(emitter_id,x,y,0);
Destroy:
audio_emitter_free(emitter_id);
However, i'd like to have some sounds continuous that for example the player's units make, like horses galloping, but I can't make the 3d sounds pause when the unit stops and continue again when it moves. The sound never stops when the character does, and it just keeps stacking the sound when the character resumes movement...
Create:
emitter_id = audio_emitter_create();
Step:
audio_emitter_position(emitter_id,x,y,0);
if speed > 0
{
emitter_id = audio_emitter_create(); //to recreate the sound when unit is moving
audio_play_sound_on(emitter_id,gallop,0,1)
}
if speed = 0
{
audio_emitter_free(emitter_id);
}
Any clues what im doing wrong here?
P.s. can someone tip me how to put these codes into the form everyone prefers on the forums here...
Thanks beforehand!