top of page

MFP: XP and Levelling

A key part of any RPG is your character increasing in level, and therefore in power, as the game goes on. Some games employ unusual system's such as in Dark Souls, but most us an experience point (XP) system. For this project a straightforward XP system will be used. Killing an enemy will grant you some XP, once you reach your max XP, you will level up, increasing all stats by a small amount, resetting your XP to 0 and increasing your max xp. The amount of XP gained from defeating enemies, the amount it takes to level up and the stat increase per level is all subject to change and will be modified for balance purposes once a full gameplay loop is complete. For now, enemies grant XP equal to their level, it takes current level*100 XP to level up and stats increase by 1% per level except for a few exceptions.

I began by adding current and max XP float variables to the base character script. I also created a blue duplicate of the health bar in the UI and created a reference to it in the player controller script. I also made sure to default the bar's slider value to 0 rather than 1. I then added the following function to the player controller which increases current XP when called and levels the player up once they reach max XP.

Back in the base character script I made an addition to the death function which, if the dead character is an enemy, calls the player's gainXP function, sending them XP equal to the dead enemy's level.

Here's a quick demo vid of the system:


Comentários


bottom of page