Commit 4c075f0c by BellCodeEditor

save project

parent 313363a1
Showing with 8 additions and 5 deletions
...@@ -21,13 +21,16 @@ class Hero: # 英雄类 ...@@ -21,13 +21,16 @@ class Hero: # 英雄类
print(info) print(info)
exit() exit()
Hero_name = input("请输入你想创建的英雄:")
class Player(Hero): # 玩家英雄 class Player(Hero): # 玩家英雄
def __init__(self,name): def __init__(self,name):
super().__init__(name) super().__init__(name)
self.hp = 200 self.hp = 200
self.attack = 50 self.attack = 50
self.Hero_type = "射手"
player = Player("后羿") print("角色"+Hero_name+"创建成功","英雄属性为"+self.Hero_type)
print("玩家的血量值为:",player.hp) print("当前血量、等级、攻击力为:"+str(self.hp)+" "+str(self.level)+" "+str(self.attack))
print("玩家的攻击力为:",player.attack) player = Player(Hero_name)
print(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