GameMaker audio gets louder when player gets near the target

F

Furiosposion

Guest
Code:
Create:
sound = audio_play_sound(sn_water,10,true);

Step:
if (o_player.x > x+32){
audio_sound_gain(sound, ((obj_player.x-x+32)/32)/100, 1);

}else

if (o_player.x < x){
audio_sound_gain(sound, ((x-obj_player)/32)/100, 1);}
i do use this code for checking if player is getting near or far through the source of audio,
this is water object and in 32x32 in tile, but this code works wrong as this: it gets louder when player is right side of the spot it starts get louder by every going far, and gets lower on every going near, but if player is on left side of spot it always stuck at 10.59
 
Top