Commit d5e79d41 by BellCodeEditor

save project

parent 585ef308
Showing with 11 additions and 6 deletions
......@@ -22,11 +22,16 @@ class Hero: # 英雄类
exit()
class Player(): # 玩家英雄
def __init__(self,name):
???
class Player(Hero): # 玩家英雄
def __init__(self,name,hero_type,hp,attack):
super().__init__(name)
self.hp = hp
self.attack = attack
self.hero_type = hero_type
print("玩家的血量值,攻击力为:",self.hp,self.attack)
print("玩家的名字,类型为:",self.name,self.hero_type)
player = Player("后羿")
print("玩家的血量值为:",player.hp)
print("玩家的攻击力为:",player.attack)
player = Player("后羿",'射手',300,30)
player = Player("亚瑟",'战士',400,25)
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