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!

Put them into a class. Then you can store them all in a list if you like.
Sample class

class 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

I know how to make classes. I'm just asking for your suggestion. I think you should use this instead if using classes

class monster():
    def __init__(self, hp, type, attackDmg, defence):
        self.hp = hp
        self.type = type
        self.attackDmg = attackDmg
        self.defence = defence
    def attacker(self, unitBeingAttacked):
        dmgDone = self.attackDmg*unitBeingAttacked.defense

birdMon = monster(25, 'bird', 15, .5)
etcMon = monster(123,'etc',123,.1)

thanks anyway

I know how to make classes. I'm just asking for your suggestion. I think you should use this instead if using classes

class monster():
    def __init__(self, hp, type, attackDmg, defence):
        self.hp = hp
        self.type = type
        self.attackDmg = attackDmg
        self.defence = defence
    def attacker(self, unitBeingAttacked):
        dmgDone = self.attackDmg*unitBeingAttacked.defense

birdMon = monster(25, 'bird', 15, .5)
etcMon = monster(123,'etc',123,.1)

thanks anyway

It really depends on what you want.
for something as simple as a monster, with HP, a name, and some stats, anything would work

This article has been dead for over six months. Start a new discussion instead.