Python Forum
Game Logic - Pokemon like type advantages in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Game Logic - Pokemon like type advantages in python
#1
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
Reply
#2
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).
Reply
#3
(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).
Reply
#4
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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  From python game in terminal to a website game using bottle Njanez 0 3,886 Aug-13-2021, 01:11 PM
Last Post: Njanez
  [PyGame] Game Logic problem with a "The Game of Life" Replication Coda 2 3,169 Dec-24-2018, 09:26 AM
Last Post: Coda
  Collaboration on a Pokemon Game Codezters 3 4,622 Sep-14-2017, 08:07 PM
Last Post: Mekire

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020