Commit 771e4f2b by BellCodeEditor

save project

parent 8ba4f0be
Showing with 12 additions and 9 deletions
...@@ -4,16 +4,20 @@ class Hero(): ...@@ -4,16 +4,20 @@ class Hero():
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
self.name=name self.name=name
def upgrade(self):
self.level+=1
self.hp+=300
self.attack+=79
yasi=Hero("yasi",3000,389) yasi=Hero("yasi",3000,389)
houyi=Hero("houyi",2500,585) houyi=Hero("houyi",2500,585)
# print(houyi.hp) # print(houyi.hp)
def upgrade():
yasi.level+=1 yasi.upgrade()
yasi.hp+=300 houyi.upgrade()
yasi.attack+=79 print(yasi.hp)
upgrade()
upgrade()
print(yasi.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