Python Forum

Full Version: Game Logic - Pokemon like type advantages in python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I can't really wrap my head around this. I'm making this Text-based Adventure game and I want to implement these type differences (Water > Fire, Fire > Grass) into the game for more specialised attacks and mechanics. But how exactly could I code this in? Confused
Do you know how to use Classes? This is a very good example to cut your teeth on. If you use an enemy class and/or card class you can assign an element(fire, water, wind...) on creation.

THIS video is a fantastic introduction or OOP(Object, Oriented, Programing).
(Aug-17-2020, 04:52 AM)michael1789 Wrote: [ -> ]Do you know how to use Classes? This is a very good example to cut your teeth on. If you use an enemy class and/or card class you can assign an element(fire, water, wind...) on creation.

I am actually using OOP for this project since I thought this would be perfect for this type of thing and because I wanted to learn and practise OOP. Possibly elaborate on your answer? Tongue And I might include a shortened version of the code (Shortened version - 270 lines, dunno if this big code can be included in this forum).
class Fire_monster():
    def __init__(self, name):
        self.name = name
        self.value = 5
        self.elements = ("fire", "air", "magic")
        self.HP = 1000
        self.attack = 30
        self.mana = 100

monster = Fire_monster("Sinder")

print(monster.name, monster.elements)