Experience and level system

Ask about a PHP problem here.
Post Reply
User avatar
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Experience and level system

Post by EcazS »

I have an array that looks like this,
[1] => 400
[2] => 900
[3] => 1400
[4] => 2100
[5] => 2800
And I'm storing the current XP in a database along with the users level. Now I'm trying to find out a way to increment the users level by how much XP they have, not all that hard but if the user is level one and he gets 1200 XP directly, my system only increments the users level once per page-refresh and then it resets the XP to 0.

I asked this on stackoverflow and they told me not to reset the XP the only problem is if I don't do that then I have to completely redo the amount of XP per level, because when you get to level 2 you have 400 XP, and then you only need 500 XP to the next level, instead of 400 and then 920.

Any ideas on how I should do this? I currently have about 60 levels.
Post Reply