Created
February 8, 2014 10:01
-
-
Save seanbollin/8881327 to your computer and use it in GitHub Desktop.
Recursive function to calculate XP to level
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
levelUpExperience: function(level) { | |
if (!level) { level = this.level + 1; } | |
if (level === 2) return 100; | |
return (25 * Math.pow(level, 2)) + this.levelUpExperience(level - 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment