The code works well with only one instance of the barrel object, but doesn't when there are several instances.
Example: The player stands right by one barrel and shoots a barrel standing far away, the hit sound plays as loud as if the player were standing next to it. Also, equally as often the sound is very low even though the player shoots a very close barrel.
This code is in the step event of the barrel object, and the "obj_guybody" is the player character.
I've never been good with code though I understand most of the basic stuff. I guess I need to alter the code to only affect the current barrel being hit.
if distance_to_object(obj_guybody)>3000
{
sound_volume(snd_metalthump1,0)
sound_volume(snd_metalthump2,0)
sound_volume(snd_metalthump3,0)
}
else
{
Vol=1
Vol-=distance_to_object(obj_guybody)/2000
sound_volume(snd_metalthump1,Vol)
sound_volume(snd_metalthump2,Vol)
sound_volume(snd_metalthump3,Vol)
}











