Making A Simple Leveling System In Python
My question is how you make a simple level system. Example is every win you get you get 10 XP. In order to level up you need to get 100 XP. Just wondering what’s the basic way of doing this.
A side question is how would you make a prestige system, every 10 levels you get a prestige?
Edit: Added the 'In Python' to the title.
A level system takes advantage of both variables and if statements. Declare XP, Level, and Prestige variables at the start:
xp = 0 player_level = 1 player_prestige = 0
Then in your main game code, update XP, then Level, then Prestige, accordingly. This is where the conditionals come into play:
... if (player_has_won): print('you won!') # First, give the player XP xp += 10 # If the player can level up, do so if (xp >= 100): level += 1 xp = 0 # If the new level is a multiple of 10 (every 10 levels...) award a prestige if (level % 10 == 0): prestige += 1 ...