Commit 273433f1 by BellCodeEditor

save project

parent e6e574c3
Showing with 8 additions and 6 deletions
......@@ -23,11 +23,13 @@ class Hero: # 英雄类
class Player(Hero): # 玩家英雄
def __init__(self,name):
def __init__(self,name,hero_type,hp,attack):
super().__init__(name)
self.hp = 10000
self.attack = 999
self.hp = hp
self.attack = attack
self.hero_type = hero_type
print("玩家的名字,类型",self.name,self.hero_type)
print("玩家的生命,攻击力",self.hp,self.attack)
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