Commit cffa2d31 by BellCodeEditor

save project

parent 43f5999d
Showing with 8 additions and 5 deletions
...@@ -22,14 +22,16 @@ class Hero: # 英雄类 ...@@ -22,14 +22,16 @@ class Hero: # 英雄类
exit() exit()
class Player(): # 玩家英雄 class Player(Hero): # 玩家英雄
def __init__(self,name): def __init__(self,name,a):
super().__init__(name) super().__init__(name)
self.hp = 88 self.hp = 88
self.attack = 999 self.attack = 999
self.a=a
print('角色'+self.name+'创建成功,类型为:',self.a)
print('该角色伤害,等级,血量分别为:',self.attack,self.level,self.hp)
player = Player("卢本伟") player = Player("卢本伟","战士")
print("玩家的血量值为:",player.hp) \ No newline at end of file
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