Commit 1a7d8ebc by BellCodeEditor

save project

parent 82c8d7c5
Showing with 5 additions and 2 deletions
......@@ -20,11 +20,14 @@ class Hero(object):
print(info)
exit()
class Player(Hero):
def __init__(self,name):
def __init__(self,name,Hero_type):
super().__init__(name)
self.hp = 300
self.attack = 2
player=Player("后羿")
self.Hero_type=Hero_type
print("角色"+self.name+"创造成功,英雄类型为:",self.Hero_type)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
player=Player("后羿","射手")
print("玩家血量是:",player.hp)
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