Commit 76a37704 by BellCodeEditor

save project

parent b4e599c4
Showing with 8 additions and 7 deletions
...@@ -18,13 +18,15 @@ class Hero(): ...@@ -18,13 +18,15 @@ class Hero():
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi= Hero("后羿") houyi= Hero("后羿")
class Player(Hero): class Player(Hero):
def __init__(self,name): def __init__(self,name,type):
super().__init__(name) super().__init__(name)
self.hp = 100 self.hp = 100
self.attack = 400 self.attack = 400
player = Player("后羿") self.type = type
print("欢迎来到王者农药")
print("玩家的血量为:",self.hp)
print("玩家的等级为:",self.level)
print("玩家的攻击力为:",self.attack)
print("玩家的名称为:",self.name)
player = Player("后羿","射手")
computer = Hero("亚瑟") computer = Hero("亚瑟")
print("玩家的血量为:",player.hp)
print("玩家的等级为:",player.level)
print("玩家的攻击力为:",player.attack)
print("玩家的名称为:",player.name)
\ No newline at end of file
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