Commit 62effce1 by BellCodeEditor

save project

parent 075fd6ec
Showing with 18 additions and 10 deletions
...@@ -20,16 +20,24 @@ class Hero: # 英雄类 ...@@ -20,16 +20,24 @@ class Hero: # 英雄类
info = info1+info2+info3 info = info1+info2+info3
print(info) print(info)
exit() exit()
class Player(Hero): # 玩家英雄 yase=Hero("亚瑟")
def __init__(self,name,hero_type): houyi=Hero("后羿")
super().__init__(name) yase.combat(houyi)
self.hp = 200 yase.combat(houyi)
self.attack = 50 yase.combat(houyi)
self,hero_type=hero_type yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
class Player(Hero): # 玩家英雄
def __init__(self,name):
super().__init__(name)
self.hp = 200
self.attack = 50
houyi = 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