Commit b47d777c by BellCodeEditor

save project

parent 7bdf8fb0
Showing with 7 additions and 6 deletions
...@@ -4,16 +4,17 @@ class Hero(): ...@@ -4,16 +4,17 @@ class Hero():
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
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) 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