6
I created this calculation based on multiples below to determine how much experience the character will need to level up.
float NeededExperience(int level, float experienceRatio = 100F)
{
float neededExperience = ((level - 1) * experienceRatio) * level;
if(neededExperience == 0F)
neededExperience = experienceRatio;
return neededExperience;
}
With this function, defining that the experienceRatio
is equal to 100, and the user level is 1, he will need 200 experience to reach level 2 and 600 to level 3...
But I would like to do the opposite calculation, which calculates the level of the character from the amount of experience he has, for example: a user who has between 2000 and 2999 experience is at level 5.
Or if this is not the best way to calculate experience, I also accept suggestions.
With this method I could modify to also have the result in the opposite direction? passing as parameter the level and returning the necessary experience.
– Rafael Alexandre
But you already do exactly that in its original function. There is nothing to "modify".
– Luiz Vieira