Commit 2aa4a685 by BellCodeEditor

auto save

parent 1cda74d9
Showing with 12 additions and 3 deletions
class Hero: # 英雄类
def __init__(self, name): # 实例属性 def __init__(self, name): # 实例属性
self.name = name self.name = name
self.level = 1 self.level = 1
self.hp = 250 self.hp = 250
self.attack=40 # 英雄类tack = 40 self.attack = 40
self.name=name self.max_hp = self.hp
def combat(self, enemy): # 攻击功能 def combat(self, enemy): # 攻击功能
...@@ -22,3 +22,12 @@ ...@@ -22,3 +22,12 @@
exit() exit()
class Player(): # 玩家英雄
def __init__(self,name):
self.level=1
self.hp=250
self.attack=3
class player(后羿)
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