Commit 986b980f by BellCodeEditor

auto save

parent 486c0ddf
Showing with 9 additions and 11 deletions
class Hero: class Hero:
def __init__(self,name,hp,attack): def __init__(self,name):
self.name=name self.name=name
self.hp=hp self.hp=250
self.attack=attack self.attack=40
self.level=1 self.level=1
def upgrade(self): # def upgrade(self):
self.level+=1 # self.level+=1
self.hp+=100 # self.hp+=100
self.attack+=100 # self.attack+=100
yase=Hero("亚瑟",1000,10000) yase=Hero("亚瑟")
yase.upgrade() \ No newline at end of file
print(yase.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