Commit 91e3c160 by BellCodeEditor

save project

parent 83f0863d
Showing with 10 additions and 4 deletions
......@@ -5,6 +5,7 @@ class Hero:
self.hp = 3500
self.attack = 388
self.name = name
self.max_hp=self.hp
def combat(self,enemy): # 攻击
info1 = self.name + '对' + enemy.name + '发起攻击,'
......@@ -21,6 +22,12 @@ class Hero:
exit()
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
class Player(Hero):
def__init__(self,name):
super().__init__(name)
self.hp=200
self.attack=50
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