Commit 5ac5674a by BellCodeEditor

save project

parent e575296d
Showing with 9 additions and 10 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level = 1
self.level = name
self.name = name
self.hp = hp
self.attack = attack
def upgrade():
yase.level = yase.level+1
yase.hp=yase.hp+20
yase.attack=yase.attack+10
yase=Hero("亚瑟",540,60)
print(yase.hp)
upgrade()
print(yase.hp)
def upgrade(self):
self.level = self.level+1
self.hp = self.hp+20
self.attack = self.attack+10
houyi=Hero("亚瑟",540,60)
print(houyi.hp)
houyi.upgrade()
print(houyi.hp)
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