2018-04-04 20:26:06

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. When I put a new  sound, for example a step for another terrain, do I have to repeat the procedure, putting again the max distance etc etc?
Is there an easier alternative than what I've posted here?
Thanks in advance, code below.

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

void main()
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
sound_environment.play_stationary("sounds/steps/"+step+sound_extension, false);
sound_environment.play_stationary("sounds/steps/"+step+sound_extension, false);

Thumbs up

2018-04-04 21:07:08

Generally, you only need one sound_pool. It's very rare that an audio game would need more than one (For example, I use another in ECTAS to create a perilax effect for background sounds, which only makes sense for a side-scroller).
For your example, the parts that use sound_environment are correct. You could save typing by only calling sound_environment.update_listener1d(x); once.
You should only need to set properties such as max_distance, for example, one time. After setting up the sound_pool in the beginning, you only need one line to play any sound.

Personally, I would either use the sound extension directly, or shorten the name of the sound_extension variable to save typing.
Regarding the example with the for loop, that should play the 15 sounds almost simultaneously.
You will not need to repeat the whole proceedure for a new terrain. You'd just use the play_stationary, play_1d, or play_2d methods.

Some of my games
Keep up to date by following @Jeqofire on twitter!
Ear Ninja?

Thumbs up

2018-04-06 15:43:37

Allright, so it seems the sound pool is not very compatible with... my way of working so I've decided to skip it. My question is, does anyone know  any metod for positioning the sound in relation with the player? For example, I have the enemy and the player on a  side scroller map, and I want the enemy to be heard left, center or right in relation to the player.
Also, please, any tricks for the sounds not to be cut anymore when another one is plaied? When the enemy attacks, my footsteps aren't heard anymore  until the attack ends.

Thumbs up

2018-04-06 21:53:54

you can try using position_sound_1d position_sound_custom_1d etc etc.

If you want to get in touch with me you can follow me on Twitter
have a nice day.