-2
I am having some doubts, I am creating an RPG by commands, simple thing to put in practice what I am learning. The truth is that I caught in a situation, I want to create a command in which the Player chooses the "Hunt" function, from there is generated a random number (between 1 and 100) that will define how much XP he won in the hunt, then I wanted to add this random number to the player experience, adding every time he hunts, well, I got some results and several problems too:
import random, time
level = 1
n_level = 50
exp_loot = random.randint(1,100)
exp = 0
while exp >= n_level:
level += 1
n_level = round(n_level * 2)
def separador():
print('-' * 50)
def hunt():
exp_loot = random.randint(1,100)
return exp_loot
def stats():
separador()
print('Level: {}'.format(level))
print('EXP: {}/{}'.format(exp, n_level))
separador()
while True:
player = int(input(''))
if player == 0:
print('Voce está caçando..')
exp += hunt()
time.sleep(1)
print('Você ganhou {}xp'.format(hunt()))
elif player == 1:
stats()
When the Player enters the number 1, it shows the status (Level and XP) When you enter the number 0 he hunts
But the sum of the random Xp is not correct, someone can help me?
Man, that’s exactly what I needed, you’re an angel, thank you very much
– Rodrigo Moreira
Arigatou Gozaimasu <3
– JeanExtreme002