Commit abd1f920 by BellCodeEditor

save project

parent f974650a
Showing with 13 additions and 2 deletions
class Hero:
def __init__(self, name):
def __init__(self, name,hp,attack):
self.name = name
self.level=1
self.hp = 250
self.attack = 23
hoyi=Hero("后羿")
hoyi=Hero("后羿",250,23)
def upgrade():
hoyi.level=hoyi.level+1
hoyi.hp=hoyi.hp+50
hoyi.attack=hoyi.attack+4
upgrade()
upgrade()
print(hoyi.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