Skip to content

Commit

Permalink
Add method to check if the user has leveled up from earning XP
Browse files Browse the repository at this point in the history
  • Loading branch information
lulunac27a committed Oct 20, 2024
1 parent 6fd5e14 commit 9220f1c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def add_xp(self, amount): # add XP
"""
self.xp += amount # add XP by amount
self.total_xp += amount # add total XP by amount
self.check_level_up() # check if user has leveled up

def check_level_up(self): # check if user has leveled up
while (
self.xp >= self.xp_required
): # if user XP is greater than or equal to XP required
Expand Down

0 comments on commit 9220f1c

Please sign in to comment.