Commit caad0f14 by BellCodeEditor

save project

parent 1f4f1940
Showing with 7 additions and 7 deletions
...@@ -4,11 +4,11 @@ class Hero: ...@@ -4,11 +4,11 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
pengpenglaoshi=Hero("彭彭老师",300,20)
#print(pengpenglaoshi.hp) def upgride(self):
def upgride(): self.level=self.level+1
pengpenglaoshi.level=pengpenglaoshi.level+1 self.hp=self.hp+70
pengpenglaoshi.hp=pengpenglaoshi.hp+50 self.attack=self.attack+10
pengpenglaoshi.attack=pengpenglaoshi.attack+4 pengpenglaoshi=Hero("彭彭老师",300,9999)
upgride() Hero.upgride(pengpenglaoshi)
print(pengpenglaoshi.hp) print(pengpenglaoshi.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