Simple levelling system

By Pinohkio
Copied from

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 total][=][0] // this is the amount of xp our player has
WHEN [once] DO [numvar:xp to level][=][10] //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][=][1] //this is his current level number

Then we add the Kode that says what happens when you have enough xp to level up


WHEN [numvar:xp total][>=][numvar:xp to level] // when your player has enough or more xp to level up
…WHEN [started to] DO [numvar:level][increment by][1] // 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


WHEN [x][pressed] DO [attack][with damage][numvar:damage output]

Add some display options


WHEN DO [display meter][gallery:xp meter]

[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 [interacted] DO
…WHEN DO [it][numvar:xp total][increment by][1] // or however many xp an apple is worth

In the goblins


WHEN [hit by attack] DO [my attacker][=][it]
…WHEN [started to][is dead] DO [my attacker][numvar:xp total][increment by][5]

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.

Comments are closed.

Website Powered by

Up ↑

%d bloggers like this: