Commit f1fe54d0 by BellCodeEditor

save project

parent da60e227
Showing with 8 additions and 8 deletions
# 英雄角色类
class Hero(object): class Hero(object):
def __init__(self, name): def __init__(self, name,h,a):
self.level = 1 self.level = 1
self.hp = 3500 self.hp = h
self.attack = 388 self.attack = a
self.name = name self.name = name
def combat(self,enemy): # 攻击 def combat(self,enemy): # 攻击
...@@ -17,6 +16,8 @@ class Hero(object): ...@@ -17,6 +16,8 @@ class Hero(object):
print(info1 + info2 + info3) print(info1 + info2 + info3)
yase = Hero("垭瑟") yase = Hero("垭瑟",3500,388)
houyi= Hero("后羿") huoqubing = Hero("霍去病",2000,500)
yase.combat(houyi)
\ No newline at end of file yase.combat(huoqubing)
huoqubing.combat(yase)
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