So i need a Mathematical formula so that it turns xp into a level (max lvl 100)
I want it to double the xp required each time so
Lvl1: 0
Lvl2: 10
Lvl3: 20
Lvl4: 40
Lvl5: 80
Lvl6: 160
Lvl7: 320
Lvl8: 640
Lvl9: 1280
Lvl10: 2560
Etc...
Offline
Here's the script, and I'll write an explanation below it.
(The ExperienceNeeded Variable is unnecessary, it just makes the logic behind the script clearer to someone looking at it.)
The formula to double a certain number for each iteration (or level) is InitialNumber*2^(Iteration-1), or in your case, 10*2^(Level-1), because now each iteration causes the formula to add another *2 into the equation.
Unfortunately, in Scratch there is no exponent ( this symbol: ^) function, so we need to use other blocks to create one. An in depth look of how this method works is on the Scratch Wiki, here.
Now all that's left is to make the script check if your Experience variable is greater than the required amount of Experience, and if it's true, to raise the level.
Last edited by Kileymeister (2013-01-25 12:04:57)
Offline
this works very well but, inorder to get lvl 98 you need 1231283091238123812093810238120 xp but lvl 2 is 5xp, is there any way that instead of doubling, the xp required changes by 20% of the former xp required
Offline