So, you want the sound to get louder as your mouse cursor gets towards the bottom right of the screen. And less loud as the cursor goes upwards or to the left.
Is that correct? (Because that's what your code says).
As an example, my screen is 1920 x 1200 pixels wide. Using your calculation method, if my cursor is at the bottom right, then
mx*mx=3,686,400. (2920 x 1920)
my*my= 1,440,000 (1200 x 1200)
Adding them gives 3,830,400
The square root gives 1,957 (as an integer). You cap this to 100.
But as you go to the left or upwards, the sound level will drop below 85, which seems to be the quietest that I can hear on my system.
Mathematics is the answer!
Amazing Simulation
www.amazing-forum.com