Commit 96ecc191 by BellCodeEditor

save project

parent 3eecce1a
Showing with 6 additions and 5 deletions
...@@ -4,9 +4,10 @@ class Hero: ...@@ -4,9 +4,10 @@ class Hero:
self.name = name self.name = name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upgrade(self):
self.levle=self.levle+1
self.hp=self.hp+40
self.attack=self.attack+20
yao=Hero("瑶",300,89) yao=Hero("瑶",300,89)
def upgrade(): yao.upgrade()
yao.hp=yao.hp+40 print(yao.levle)
yao.attack=yao.attack+20
upgrade()
print(yao.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