Commit 93b46c57 by BellCodeEditor

save project

parent 5b7ec919
Showing with 8 additions and 4 deletions
...@@ -5,9 +5,12 @@ class Hero: ...@@ -5,9 +5,12 @@ class Hero:
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
def upgrade(): def upgrade(self):
yase.hp += 50 self.hp += 50
yase.attack += 20 self.attack += 20
yase.level += 1 self.level += 1
yase = Hero("yase",300,20) yase = Hero("yase",300,20)
houyi = Hero("houyi",250,23) houyi = Hero("houyi",250,23)
print(yase.level)
yase.upgrade()
print(yase.level)
\ 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