Commit 0a8417eb by BellCodeEditor

auto save

parent bd93f2a0
Showing with 9 additions and 2 deletions
...@@ -2,7 +2,13 @@ class Hero: ...@@ -2,7 +2,13 @@ class Hero:
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.level = 1 self.level = 1
self.name = name self.name = name
self.hp = 300 self.hp = hp
self.attack = 20 self.attack = attack
def upgrade():
yase.level = yase.level + 1
yase.hp = yase.hp+50
yase.attack = yase.attack+20
yase = Hero("亚瑟",300,50) yase = Hero("亚瑟",300,50)
print(yase.hp)
upgrade()
print(yase.hp) 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