Commit 52e8a4f6 by BellCodeEditor

save project

parent 5609c5e1
Showing with 8 additions and 8 deletions
class Hero(): class Hero():
def __init__(self,name,up,attack): def __init__(self,name,hp,attack):
self.level = 1 self.level = 1
self.up = 300 self.hp = 300
self.attack = 40 self.attack = 40
self.name =name self.name =name
def up(self): def up(self):
self.level=self.level+1 self.level=self.level+1
self.up=yase.up+50 self.hp=yase.hp+50
self.attack=yase.attack+4 self.attack=yase.attack+4
yase=Hero("亚瑟"300,20) yase=Hero("亚瑟",300,20)
print(yase.hp) print(yase.attack)
upgrade() yase.up()
upgrade() yase.up()
print(yase.hp) print(yase.attack)
......
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