Commit dbb77406 by BellCodeEditor

save project

parent 2f1ddbc5
Showing with 8 additions and 6 deletions
...@@ -14,12 +14,13 @@ class Hero: ...@@ -14,12 +14,13 @@ class Hero:
print(info) print(info)
exit() exit()
class Player(Hero): class Player(Hero):
def __init__(self,name): def __init__(self,name,hero_type):
self().__init__(name) self(Player,self).__init__(name)
self.hp = 200 self.hp = 200
self.attack = 50 self.attack = 50
player = Player("后一") self.hero_type = hero_type
print("血量为:",player.hp) print("血量为:",self.hero_type)
print("血量为:",player.attack) print("血量为:",self.level,self.hp,self.attack)
houyi = Player("后一","射手")
yase = Hero("垭瑟")
\ 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