as you know I'm making a text adventure using Python. Should I put the monster's stats into a class or dictionary?
Please suggest. All suggestions welcome!
jeffery12109
-4
Newbie Poster
Recommended Answers
Jump to PostPut them into a class. Then you can store them all in a list if you like.
Sample classclass Monster: def __init__(self): #Store the unit attributes self.hp = 25 self.type = 'bird' self.attackDmg = 15 self.defence = .5 def attcker(self,unitBeingAttacked) dmgDone = self.attackDmg*unitBeingAttacked.defense
All 3 Replies
tbone2sk
14
Junior Poster in Training
jeffery12109
-4
Newbie Poster
jcao219
18
Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.