Hello.
I need help with ambiences in bgt.
How do I make a sertan ambience to play at x, y, z, that I want, and how do I make it so it pans when you walk.
I tried sound_pozitioning, but I can't get it to work.
Any help would be apprishiated.

Thumbs up

If you don't want to use the sound_pool:

// Global, or in a class instance:
[email protected] amb;

void init_amb (){ 
sound temp;
ámb=temp;
amb.load("ambience.ogg"); // use the filename you want.
} 

// assuming you have player position variables:
void update_amb (int player_x, int player_y, int player_z) { 
position_sound_3d (amb, player_x, player_y, player_z, amb_x, amb_y, amb_z, 1, 1, 1);
}
 

If you'd rather use the sound_pool, it's much simpler, especially if you have multiple sounds:

sound_pool pool;

void init_amb (){ 
pool.play_3d ("amb.ogg", player_x, player_y, player_z, amb_x, amb_y, amb_z, true);
}

//after you've moved the player:
pool.update_listener_3d (player_x, player_y, player_z, player_angle);

I might have forgotten when to use the listener angle in there, but that's easy enough to check (I'm typing this on my phone sad ).
Basically, you need to update the sound every time the player moves. The sound_pool does this for all playing sounds with a single method, that only takes the player's new position. So, unless I'm trying to do something fancy like sound rings, I'd just stick with the sound_pool.

Thumbs up

Hi.
I can't get it to work.

Thumbs up