Commit cc39c433 by BellCodeEditor

save project

parent f5d67a82
Showing with 9 additions and 10 deletions
...@@ -22,16 +22,15 @@ class Hero: # 英雄类 ...@@ -22,16 +22,15 @@ class Hero: # 英雄类
exit() exit()
class Player(): # 玩家英雄 class Player(Hero): # 玩家英雄
def __init__(self, name): # 实例属性 def __init__(self, name,hero_type): # 实例属性
super()__init__(name) super(Player,self).__init__(name)
self.level = 2 self.hp = 99
self.hp = 99999999999999999999999999999999999999999999999999999 self.attack = 9
self.attack = 9999999999999999999999999999999999999999999999999999999 self.hero_type=hero_type
self.max_hp = self.hp print("角色"+self.name+"类型为:",self.hero_type)
print("等级,血量,攻击力为:",self.level,self.hp,self.attack)
player = Player("后羿") player = Player("后羿","射手")
print("玩家的血量值为:",player.hp) print("玩家的血量值为:",player.hp)
print("玩家的攻击力为:",player.attack) print("玩家的攻击力为:",player.attack)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment