Experience formula with javascript
Posted
by
StealingMana
on Game Development
See other posts from Game Development
or by StealingMana
Published on 2012-06-10T13:40:14Z
Indexed on
2012/06/10
16:48 UTC
Read the original article
Hit count: 487
I'm having trouble working out a formula using this experience curve to get the total exp after each level. I bet its easy and im just over thinking it.
maxlvl = 10;
increment = 28;
baseexp = 100;
function calc(){
for (i = 0;i<(maxlvl*increment);i+=increment){
expperlvl = baseexp + i;
document.writeln(expperlvl);
}
}
I figured it out.
maxlvl=6;
base=200;
increment=56;
function total(){
totalxp= (base*(maxlvl-1))+(increment*(maxlvl-2)*(maxlvl-1)/2);
document.write(totalxp);
}
© Game Development or respective owner