Skip to main content
deleted 81 characters in body
Source Link
Perry
  • 3.9k
  • 26
  • 40
  • 51

I am pretty new in python and having a hard time with classes.

Here is the guide:

  • Add a Boss class which inherits all of the features of the Character class.
  • Add the following method to the Boss class: spawn(), generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max. The Minion should be the same level as the Boss but have 0 exp and 0 defense.

So how to generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max?

if I try this line of code, and give each of the variable its difference method, in that case where "spawn" method should go?

class Boss(Character):
    def __init__(self, name=Minion, lvl=1, hp=100, at=10, df=1, exp=None):
        self.name = name
        self.lvl = lvl
        self.hp = hp
        self.at = at
        self.df = df
    
    def spawn(self):

im so confused with OOP, probably most difficult part in python, so please help

I am pretty new in python and having a hard time with classes.

Here is the guide:

  • Add a Boss class which inherits all of the features of the Character class.
  • Add the following method to the Boss class: spawn(), generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max. The Minion should be the same level as the Boss but have 0 exp and 0 defense.

So how to generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max?

if I try this line of code, and give each of the variable its difference method, in that case where "spawn" method should go?

class Boss(Character):
    def __init__(self, name=Minion, lvl=1, hp=100, at=10, df=1, exp=None):
        self.name = name
        self.lvl = lvl
        self.hp = hp
        self.at = at
        self.df = df
    
    def spawn(self):

im so confused with OOP, probably most difficult part in python, so please help

I am pretty new in python and having a hard time with classes.

Here is the guide:

  • Add a Boss class which inherits all of the features of the Character class.
  • Add the following method to the Boss class: spawn(), generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max. The Minion should be the same level as the Boss but have 0 exp and 0 defense.

So how to generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max?

if I try this line of code, and give each of the variable its difference method, in that case where "spawn" method should go?

class Boss(Character):
    def __init__(self, name=Minion, lvl=1, hp=100, at=10, df=1, exp=None):
        self.name = name
        self.lvl = lvl
        self.hp = hp
        self.at = at
        self.df = df
    
    def spawn(self):
Tweaked formatting.
Source Link
AMC
  • 2.7k
  • 7
  • 15
  • 35

I am pretty new in python and having a hard time with classes.

Here is the guide:

"Add a Boss class which inherits all of the features of the Character class. Add the following method to the Boss class: "

  • Add a Boss class which inherits all of the features of the Character class.

spawn(), generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max. The Minion should be the same level as the Boss but have 0 exp and 0 defense.

  • Add the following method to the Boss class: spawn(), generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max. The Minion should be the same level as the Boss but have 0 exp and 0 defense.

So how to generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max?

if I try this line of code, and give each of the variable its difference method, in that case where "spawn" method should go?

class Boss(Character):
    def __init__(self, name=Minion, lvl=1, hp=100, at=10, df=1, exp=None):
        self.name = name
        self.lvl = lvl
        self.hp = hp
        self.at = at
        self.df = df
    
    def spawn(self):

im so confused with OOP, probably most difficult part in python, so please help

I am pretty new in python and having a hard time with classes.

Here is the guide:

"Add a Boss class which inherits all of the features of the Character class. Add the following method to the Boss class: "

spawn(), generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max. The Minion should be the same level as the Boss but have 0 exp and 0 defense.

So how to generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max?

if I try this line of code, and give each of the variable its difference method, in that case where "spawn" method should go?

class Boss(Character):
    def __init__(self, name=Minion, lvl=1, hp=100, at=10, df=1, exp=None):
        self.name = name
        self.lvl = lvl
        self.hp = hp
        self.at = at
        self.df = df
    
    def spawn(self):

im so confused with OOP, probably most difficult part in python, so please help

I am pretty new in python and having a hard time with classes.

Here is the guide:

  • Add a Boss class which inherits all of the features of the Character class.
  • Add the following method to the Boss class: spawn(), generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max. The Minion should be the same level as the Boss but have 0 exp and 0 defense.

So how to generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max?

if I try this line of code, and give each of the variable its difference method, in that case where "spawn" method should go?

class Boss(Character):
    def __init__(self, name=Minion, lvl=1, hp=100, at=10, df=1, exp=None):
        self.name = name
        self.lvl = lvl
        self.hp = hp
        self.at = at
        self.df = df
    
    def spawn(self):

im so confused with OOP, probably most difficult part in python, so please help

Source Link
user12772128
user12772128

Adding method to inherited class in Python 3

I am pretty new in python and having a hard time with classes.

Here is the guide:

"Add a Boss class which inherits all of the features of the Character class. Add the following method to the Boss class: "

spawn(), generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max. The Minion should be the same level as the Boss but have 0 exp and 0 defense.

So how to generates a Minion named "Minion" with HP and attack equal to 1/4 (rounded down) of the Boss's max?

if I try this line of code, and give each of the variable its difference method, in that case where "spawn" method should go?

class Boss(Character):
    def __init__(self, name=Minion, lvl=1, hp=100, at=10, df=1, exp=None):
        self.name = name
        self.lvl = lvl
        self.hp = hp
        self.at = at
        self.df = df
    
    def spawn(self):

im so confused with OOP, probably most difficult part in python, so please help