Commit b039debc by BellCodeEditor

save project

parent b88f9052
Showing with 7 additions and 3 deletions
...@@ -18,12 +18,16 @@ class Hero: ...@@ -18,12 +18,16 @@ class Hero:
print(info) print(info)
exit() exit()
class Player(Hero): class Player(Hero):
def __init__(self,name): def __init__(self,name,hero_type):
super().__init__(name) super().__init__(name)
self.hp= 900 self.hp= 900
self.attack= 50 self.attack= 50
player = Player("亚瑟") self.hero_type = hero_type
print(player.hp) print("角色"+self.name+"创造成功.英雄类型为:",self.hero_type)
print("当前等级、血量、攻击力为:",self.level,self.hp,self.attack)
player = Player("后羿","射手")
print("玩家血量值为:",player.hp)
print("玩家攻击力为:",player.attack)
# def upgrade(self): # def upgrade(self):
# self.level=self.level+1 # self.level=self.level+1
......
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