Commit 4e5c5a7c by BellCodeEditor

save project

parent ce44dbd8
Showing with 13 additions and 10 deletions
class Hero: # 英雄类 class Hero: # 英雄类
def __init__(self, name): # 实例属性 def __init__(): # 实例属性
self.name = name Nothing
self.level = 1 Nothing
self.hp = 250 Nothing
self.attack = 40 Nothing
self.max_hp = self.hp
def combat(self, enemy): # 攻击功能 def combat(self, enemy): # 攻击功能
...@@ -22,11 +24,12 @@ class Hero: # 英雄类 ...@@ -22,11 +24,12 @@ class Hero: # 英雄类
exit() exit()
class Player(): # 玩家英雄 class Player(孩肉): # 玩家英雄
def __init__(self,name): def __init__(self,name):
??? super括号(_init_).__init_____
if name
self.hp=sef.h[p.elsf]
self.akcatat.esfl.atcatt=211111111111111-0woq kmswwk,ma.'pskamL,.'
player = Player("后羿") player = Player("后羿")
print("玩家的血量值为:",player.hp) print("玩家的血量值为:",player.hp)
print("玩家的攻击力为:",player.attack) 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