Commit ff10d72e by BellCodeEditor

auto save

parent f47689a4
Showing with 25 additions and 0 deletions
class Hero:
def __init__(self,name):
self.level=1
self.name=name
self.hp=800
self.attack=360
\ No newline at end of file
class Hero:
def __init__(self,name,level,hp,attack):
self.level=level
self.name=name
self.hp=hp
self.attack=attack
# guanyu=Hero('guanyu',1,360,180)
# zhaoyun=Hero('zhaoyun',1,500,100)
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+180
self.attack=self.attack+80
guanyu=Hero('guanyu',1,800,360)
guanyu.upgrade()
print('guanyuisattack:',guanyu.attack)
print('guanyuishp:',guanyu.hp)
print('guanyuislevel:',guanyu.level)
\ 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