Commit 8cba1bca by BellCodeEditor

save project

parent ecb7f152
Showing with 9 additions and 1 deletions
...@@ -17,7 +17,15 @@ class Hero(object): ...@@ -17,7 +17,15 @@ class Hero(object):
info3 = enemy.name + '已去世,游戏结束' info3 = enemy.name + '已去世,游戏结束'
print(info1+info2+info3) print(info1+info2+info3)
exit() exit()
class player(Hero):
def __init__(self,name,houyi_type):
super().__init__(name)
self.hp = 200
self.attack = 50
self.houyi_type = houyi_type
print(self.name + '创建成功,类型为' + self.houyi_type)
print(self.name + '等级,血量,攻击力分别为',self.level,self.hp,self.attack)
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi= Hero("后羿") houyi = player("后羿",'射手')
yase.combat(houyi) yase.combat(houyi)
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