I have the following function:
function getLevel(points)
{
var level = -1 + Math.sqrt(4 + points/20);
// Round down to nearest level
return Math.floor(level);
}
The above function calculates the level of a player based on their points, my problem is that I need a function like this to calculate the points needed for a given level.
The inverse of that function would be:
points = ((level + 1)**2 - 4) * 20
(where ** is the power operator).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With