Commit a86bce50 by BellCodeEditor

save project

parent 22354288
Showing with 22 additions and 0 deletions
class Hero():
def __init__(self,name,level,hp,attack,baoji):
self.level = 1
self.hp = hp
self.attack = attack
self.baoji = baoji
#升级函数
def upji(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
self.baoji=self.baoji+10
ya_suo = Hero("ya_suo",1,300,20,10)
a_li = Hero("a_li",1,250,23,0)
ya_suo.upji()
ya_suo.upji()
print("亚索的生命值为:",ya_suo.hp)
print("阿狸的生命值为:",a_li.hp)
\ 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