Copied from ProjectSpark.com
Simple Levelling system by Pinohkio (adapted by LadylexUK)
For this tutorial we will be creating a levelling system based on XP.
XP can be gained by killing goblins or eating apples.
As you level up the amount of XP you need to get to the next level increases.
The amount of damage you inflict on your enemies is also increased as you level up.
The XP is displayed on a meter, and your damage level is also shown
In your player brain
First we set up our number variables.
WHEN [once] DO [numvar:xp to level][=] //this is how much xp he needs to level up
WHEN [once] DO [numvar:damage output][=]10] // this how much health damage he will inflict
WHEN [once] DO [numvar:level][=] //this is his current level number
Then we add the Kode that says what happens when you have enough xp to level up
…WHEN [started to] DO [numvar:level][increment by] // add 1 to the level number
…/…WHEN DO [numvar:xp total][=][numvar:xp total][-][numvar:xp to level] // set the xp meter back to 0 plus any extra xp
…/…WHEN DO [play fx][Level up Champion][on][me] // play an effect when you level up
…WHEN DO [numvar:damage output][=][(][round][numvar:damage output][multiplied by][1.2][)] // increases the amount of damage the player can inflict
Change the default melee line to
Add some display options
[numvar:xp total][max][numvar:xp to level][screen top left]
WHEN DO [display][text:Level: ][+][numvar:level][screen top left][HUD stack left]
WHEN DO [display][icon:Melee][screen top right]
WHEN DO [display][text:<size:40>][numvar:damage output][screen top right][no HUD stack]
Now all you need to add is your Kode to increase xp.
In the apples or other interactable object that gives you xp
…WHEN DO [it][numvar:xp total][increment by] // or however many xp an apple is worth
In the goblins
…WHEN [started to][is dead] DO [my attacker][numvar:xp total][increment by]
And there is your simple levelling system. You can give xp to your player for completing tasks, entering a special area, collecting objects or anything really. You can use the level number to affect the way he looks, or what weapon he has equipped, or whether he can enter a certain area. You can also make enemies more dangerous depending on your players level, or maybe spawn different types of enemy based on level. Experimentation is the key here.