Commit 60b662e9 by BellCodeEditor

save project

parent 03bc8d77
Showing with 9 additions and 4 deletions
class Hero: class Hero:
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.level=1 self.level=self.level
self.name=name self.name=self.name
self.hp=hp self.hp=self.hp
self.attack=attack self.attack=self.attackattack
yase=Hero('亚瑟',300,20) yase=Hero('亚瑟',300,20)
hy=Hero('后羿',250,23) hy=Hero('后羿',250,23)
k=Hero('k',5600,199) k=Hero('k',5600,199)
...@@ -19,3 +19,8 @@ print("亚瑟的血量值为",yase hp) ...@@ -19,3 +19,8 @@ print("亚瑟的血量值为",yase hp)
upgrape() upgrape()
upgrape() upgrape()
print("升级2次后,亚瑟的血量值为",yase up) print("升级2次后,亚瑟的血量值为",yase up)
houyi=Hero("后羿",150,24)
houyi.upgrape
houyi("等级为",houyi,1)
houyi("攻击为",houyi,24)
houyi("血量为",houyi,150)
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