Commit 6ac80e6a by BellCodeEditor

save project

parent a439bc97
Showing with 12 additions and 13 deletions
class Hero: class Hero:
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self,level = 1 self,level = 1
self,name = name i name:名字 self,name = name i name:名字
self,hp= hp self,hp= hp
self,attack=attack i attack:攻击 self,attack=attack i attack:攻击
def upgracte(): def upgracte():
yase.level=yase.level+1 self.level=yase.level+1
yase.hp=yase.hp+50 self.hp=yase.hp+50
yase.attack=yase.attack+4 self.attack=yase.attack+4
houyi = Hero("后羿",240,23)
yase = Hero("亚瑟",300,20) houyi.upgracte()
print("亚瑟的初始血量是:"yase.hp) print("等级为:",houyi.level)
upgratce() print("血量为:",houyi.hp)
upgratce() print("攻击力为:"houyi.attack)
print("") \ No newline at end of file
\ 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