Hi, everyone.
Recently I've discovered the awesome function sound_positioning. More than that, I've also learned how to use it.
My question is, how to proceed to make the sound being centered on more squares, not just one, like sound_positioning usually does?
For example, let's say that on the right I have a river or something else. As I get closer to it, the sound starts centering. When it's centered, I want it to remain centered about 10 or 15 squares, until I get out of the water and the sound could start changing its position according to the player position.
So, in conclusion, I'd like to know how to have the sound I've put with sound_positioning function, centered more than 1 square.
Below I'll put the code
void level1()
{
int default_weapon_item=1;
int default_weapon=0;
string sword="inactive";
x=0;
y=0;
int s_position=10;
drum.resize(50);
sound ambience;
sound step;
sound wall;
sound swordsound;
sound sabie;
ambience.stream("Sounds/Suburban Neighborhood.ogg");
ambience.volume=-5;
ambience.play_looped();
swordsound.load("Sounds/sword.ogg");
swordsound.volume=0;
wall.load("sounds/wall.ogg");
step.load("Sounds/Concrete1.wav");
step.volume=-5;
sabie.load("sounds/sword.wav");
sabie.play_looped();
for(int x=0; x<50; x++)
{
drum[x];
}
drum[2]="Casa";
drum[4]="Casa";
drum[7]="Casa";
drum[15]="Scut";
while(true)
{
wait(5);
if(key_down(KEY_LEFT)&&T.elapsed>250)
{
if(x>0)
{
T.restart();
walk_left();
position_sound_1d(sabie, x, s_position, 1, 1);
step.stop();
step.play();
spune(""+drum[x]+"");
}
}
if(key_down(KEY_RIGHT)&&T.elapsed>250)
{
if(x<51)
{
T.restart();
walk_right();
position_sound_1d(sabie, x, s_position, 1, 1);
step.stop();
step.play();
spune(""+drum[x]+"");
}
}