Commit a6902fcb by BellCodeEditor

auto save

parent c0889d16
Showing with 10 additions and 8 deletions
# 英雄角色类 # 英雄角色类
class Hero(object): class Hero:
def __init__(self, name): def __init__(self, name):
self.level = 1 self.level = 1
self.hp = 250 self.hp = 250
...@@ -18,12 +18,14 @@ class Hero(object): ...@@ -18,12 +18,14 @@ class Hero(object):
c=beida.name+"阵亡,游戏结束" c=beida.name+"阵亡,游戏结束"
abc=a+b+c abc=a+b+c
print(abc) print(abc)
exit()
class player(Hero):
def __init__(self, name):
super().__init__(name)
self.hp = 250
self.attack = 40
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi= Hero("后羿") houyi= Hero("后羿")
yase.combat(houyi) player=player("后羿")
yase.combat(houyi) print(player.hp)
yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
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