I am developing a game. How can I “fade out” the sound volume for sound based on the “distance” of the sprite from the current rendering scene? Suppose I have a world:
WIDTH_WORLD = 10000
HEIGHT_WORLD = 10000
Current Scene
xCurrent = 800 ( + Width Res. = 800 + 1024 = 1824)
yCurrent = 400 ( + Height Res. = 400 + 768 =... )
Far Sprite
xSprite = 7000
ySprite = 3000
What is a good algorithm for “calculating” sound volume (and possibly left / right channel ratios)? Thanks in advance!
source
share