I’m trying to make it so that when the noise is played the volume will decrease when the player walks away from it and the opposite when they walk closer.
You can you the distance formula and then use the result of that in whatever kind of function you want. For example, you could have it linearly decrease, or exponentially decrease ext.
Distance formula would be:
Distance = Math.sqrt(Math.pow(Player.x - SoundObject.x , 2)+Math.pow(Player.y - SoundObject.y , 2))
Real life sound decays as a quadratic, so you could use this formula:
Volume = MaxVolume / Math.pow(Distance,2)
Thank you for the reply, i understood the general idea, however i am not smart enough to apply it to flowlabs, how would i. I was thinking the ease but… complicated.
The syntax @DraftyScienceCoat75 is using is correct, and can be put in an Expression Behavior. You would input the player’s x and y positions into the first expression (they would take the places of Player.x and Player.y). The output of this expression would be put into the second expression (it would take the place of Distance).
Thank you so much the both of you, now it works nicely. However is there any good places to learn this type of stuff, or to read about it?
As far as I know, practice makes perfect with this type of thing. If you want a list of behaviors and what they do, here is the official Flowlab guide.