Are you wanting to play the sounds randomly all over the map, or for the player to place sounds on the map and hear them as they move around?
If it's the first one, you can just do this:
sound_pool pool;
int map_width=100, map_height=100;
for(uint i=1; i<=100; i++) {
pool.play_2d("sounds/amb" + i + ".ogg", 0, 0, random(0, map_width), random(0, map_height), true);
}
If it's the second one, it's even easier:
int player_x=0, player_y=0;
if(key_pressed(KEY_SPACE)) {
pool.play_2d("sounds/amb" + random(1, 100) + ".ogg", player_x, player_y, player_x, player_y, true);
}
Then just use pool.update_listener_2d when the player moves.
If, though, you want to do the second one, but preload the sounds beforehand, combine it with the example in my first reply. BGT keeps sounds in memory after they've been loaded, so you can use the sound_pool, even though it isn't very practical to preload into it directly.
看過來!
"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.