LVL = 1 //level
EXP = 0 //"min exp"
GEXP = 0//exp that monster gives
gain = 0//enables monsters to give exp
Death() //what happens when something "dies"
if(HP<=0) //hp must be below zero to "die"
view() << "[src] is destroyed by [usr]."
if(gold>=1) // makes it so gold is only dropped if they have it
usr.gold += src.gold
usr << "You get [gold] gold from [src]!"
if(src.gain==1) //if mob gives exp...
src.EXP += src.GEXP
usr << "You gain [GEXP] experience points!"
src<<"You have reached the next level!"
src.EXP=(src.EXP-EXPN)//problem is here
Okay the problem is that my code keeps miscalculating how to reset the Player's experience. If I would take out the problem line of code it automatically sets the player's experience back to zero, which I don't understand where I told it to do that (although it's a nice sentiment). I've been trying to get it so that the player's experience will "overlap" into their next level.
For example. Bob gains 100 EXP and reaches the next level so his experience after he levels up should be 0 (100EXP-100EXPN). Nick gains 105 experience and reaches the next level, his experience should now be 5 (105EXP-100EXPN).