Commit 5ac5674a by BellCodeEditor

save project

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