Initialize these at game startup
global.currentlevel=1;
global.currentxp=0;
global.nextxp=10;
global.haslevel=false;
add a script, add_xp
global.currentxp+=argument0;
while(global.currentxp>global.nextxp){
global.currentxp-=global.nextxp;
global.currentlevel+=1;
global.nextxp*=1.3;//Change this. This makes it as you level higher, it becomes harder to level up
global.haslevel=true;
<CONTROLLEROBJECT>.alarm[0]=60;//any alarm, set it to how many steps you want. Set it to the object that draws the player
}Simply call this script, and pass how much xp you would like to add. If you add 100xp, you may level 3 or 4 times. This will take into account xp overflow (putting in more xp than required to level)
In the players alarm event
global.haslevel=false;
In the draw event
if(global.haslevel){
draw_text(x,y-32,"Leveled up!#Level: "+string(global.currentlevel));
}Something along those lines. I typed it on post, so there are possibly errors in the code.
Enjoy
~~Brett14;
Edited by brett14, 11 March 2012 - 02:23 AM.