2018-04-04 20:23:26

Hi, everyone
I tried to use the sound_pool metod in |BGT, but I always get lost somewhere  between the code lines.
The problem is that I don't  understand very well what happens there all the time. I'll put the part of the code from the helper layer in BGT, along with something I tried to make, and I hope someone could explain step by step what happens in the code step by step in order to understand it  somehow.

sound_pool step1;
const string sound_extension=".wav";

void main()
{
step1.max_distance=70;
for(int counter=1; counter<15; counter++)
{
step1.play_1d("Sounds/sound"+counter+sound_extension, 0, random(0, 20), true);
}
Here comes a while with some  conditions, including
if(key_pressed(KEY_LEFT))
{
x++
sound_environment.play_stationary("sounds/steps/"+step+sound_extension, false);
sound_environment.update_listener_1d(x);
}
if(key_pressed(KEY_RIGHT))
{
x++;
sound_environment.play_stationary("sounds/steps/"+step+sound_extension, false);
sound_environment.update_listener_1d(x);