+ 1

How To Make A Battle Game With Stats? (speed, defense, etc.)

I need a way to implement stats in my Python game. Speed, Defense, Attack, etc. The system I used in my code works, but I only know how to use it for one stat. Does anyone have a different way to do it, or know how to use my current way for more stats? https://code.sololearn.com/c2l6xk944hGE/?ref=app

3rd Sep 2018, 7:12 AM
Sir White Cat
Sir White Cat - avatar
2 ответов
+ 1
Here is a way to create objects with multiple properties, this can be used for as many variables and properties as you want class Swords: def __init__(self, attack, speed): self.attack_power=attack self.weapon_speed=speed iron_sword=Swords(attack = 15, speed = 10)
3rd Sep 2018, 8:03 AM
JME
+ 2
Thanks, I'll try that out!
3rd Sep 2018, 8:15 AM
Sir White Cat
Sir White Cat - avatar