Commit 8ba2ca0d by BellCodeEditor

save project

parent 63706cdd
Showing with 8 additions and 0 deletions
...@@ -20,6 +20,11 @@ class Hero: # 英雄类 ...@@ -20,6 +20,11 @@ class Hero: # 英雄类
info = info1+info2+info3 info = info1+info2+info3
print(info) print(info)
exit() exit()
def dfjk (self):
self.hp+=60
if self.max_hp<self.hp:
self.max_hp=self.hp
print()
class Player(Hero): # 玩家英雄 class Player(Hero): # 玩家英雄
...@@ -31,3 +36,5 @@ class Player(Hero): # 玩家英雄 ...@@ -31,3 +36,5 @@ class Player(Hero): # 玩家英雄
player = Player("后羿") player = Player("后羿")
print("玩家的血量值为:",player.hp) print("玩家的血量值为:",player.hp)
print("玩家的攻击力为:",player.attack) print("玩家的攻击力为:",player.attack)
playe= Hero("f")
playe.dfjk()
\ No newline at end of file
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