Commit 1c5494bc by BellCodeEditor

save project

parent cbfe6e81
Showing with 6 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
def upgrede(): def upgrede(self):
yase.level+=1 self.level+=1
yase.hp+=50 self.hp+=50
yase.attack+=4 self.attack+=4
yase=Hero("亚瑟",300,20) yase=Hero("亚瑟",300,20)
print("亚瑟的初始血量",yase.hp) print("亚瑟的初始血量",yase.hp)
upgrede() yase.upgrede()
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