Basic Class Mortal Kombat Game

Mortal Kombat Basic Game, just click on the file that says Mortal Komabt and let me know what you think, any feedback helps. :slight_smile:

The first link doesn’t work, here’s the one that does :smiley:

Hi Hannah,

This code look awesome!! You did an amazing job! Please take my recommendations with a grain of salt. However, I would recommend creating a Player class, and making each character a subclass of the Player class. For example:

class Player:
    def __init__(self): = 50
        self.attack = 50
        self.block = 50

    def attack(self):
        return self.attack

    def block(self):
        return self.block

class Scorpion(Player):
    def __init__(self): = 1776
        self.attack = 1000
        self.block = 1500

        self.attack_moves = ['Dark Soul', 'Flip Kick',
                             'Spear Slice', 'Rising Spear'],
        self.final_kill_move = 'Hellish Dismemberment'

    def final_kill(self):
        return self.final_kill_move

Reason Why? Organization, and maintainability of your code. But, do you also see how much more control you would have over in defining each individual character?

Line 18, If you take my previous recommendations then choose_character() should be a stand alone function part from the Character class.

Online 50 you are using the __repr__ incorrectly here. __repr__ is special method used to represent a class’s objects as a string and is typically used for debugging. You want to show attributes of the character class. Not what your doing here.

On line 61, I would consider removing Fight class, and giving those attributes to your characters! Remember, with OOP, you are created a representation of real object! Now ask yourself, does a Fight have characteristics such as health, attack, or block?, No, but a Character (i.e., Player) would! You can create a Fight class, then choose_character(), and choose_enhancement() would be good methods for that class. Fight class would also track the number of rounds, so it might have a self.round_number attribute. Does that make sense?

The project could be organized better. Consider separating, classes and helper function into a different file!

I really am impressed with your code. I ope you do not mind that I forked your repo. I will play around with your code and submit a pull request in the near feature. Again, great job with this project!