Commit 5299026c by BellCodeEditor

save project

parent 3b2a7d14
Showing with 7 additions and 0 deletions
...@@ -5,7 +5,14 @@ class Hero: ...@@ -5,7 +5,14 @@ class Hero:
self.Lv=1 self.Lv=1
self.attack=attack self.attack=attack
def upgrade(self):
self.Lv=self.Lv+1
self.hp=self.hp+50
self.attack=self.attack+4
yase=Hero("亚瑟",300,20) yase=Hero("亚瑟",300,20)
print(yase.hp) print(yase.hp)
hoyi=Hero('后羿',250,23) hoyi=Hero('后羿',250,23)
print(hoyi.attack) print(hoyi.attack)
yase.upgrade()
print(yase.hp)
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