I am creating a 2D RPG game and want the Defence stat from a base number to increase by the random numbers between 4 and 8 as the player's level increases by 1 each time.
In the previous while loop the int() works fine but this one does not and I can't remember how it got fixed.
while self.S_Exp >= 0 + (self.S_Level * 100):
self.S_Level += 1
self.S_Exp -= ((self.S_Level - 1) * 250)
self.S_Level_Stats = [self.S_Exp, self.S_Level]
self.Increased_Defence = []
for loop in self.D_Stats:
loop += random.randint(4, 8)
self.Increased_Defence.append(loop)
self.D_Stats = self.Increased_Defence
self.D_Stats = self.S_Defence
What is expected is if the player level increases, the specific stat in this case Defence should increase by 4,5,6,7, or 8
Aucun commentaire:
Enregistrer un commentaire