Commit f0aa702c by BellCodeEditor

save project

parent 62b56735
Showing with 9 additions and 7 deletions
...@@ -4,14 +4,15 @@ class Hero(): ...@@ -4,14 +4,15 @@ class Hero():
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
self.level=1 self.level=1
def upgrade(self):
self.level+=1
self.hp+=50
self.attack+=4
yase=Hero("亚瑟",300,20) yase=Hero("亚瑟",300,20)
houyi=Hero("后羿",250,23) houyi=Hero("后羿",250,23)
print(yase.hp) # print(yase.hp)
# print(houyi.hp) # print(houyi.hp)
def upgrade():
yase.level+=1 houyi.upgrade()
yase.hp+=50
yase.attack+=4
upgrade()
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