I need help with an algorithm for my 2D Game.
Say entity AA is emitting a sound. The strength of the emitting sound is determined by the distance between AA and BB(this could be the main character).
The further away they are, the weaker the sound is. The max distance(pass this distance and the sound volume is 0) is of course customizable.
The volume setting can be from 0.0 to 1.0.
Where and when to do these checks is not a problem. I know my engine and I can resolve that. How to check it is the problem.