Commit dc8d5b4f by BellCodeEditor

save project

parent 646bbac0
Showing with 9 additions and 2 deletions
...@@ -5,6 +5,13 @@ class Hero: ...@@ -5,6 +5,13 @@ class Hero:
self.hp=hp self.hp=hp
self.gj=gj self.gj=gj
def upgrade(self):
self.hp=self.hp+50
self.level=self.level+1
self.gj=self.gj+4
yase=Hero("亚瑟",200,20) yase=Hero("亚瑟",200,20)
hoyi=Hero("后羿",240,23) hoyi=Hero("后羿",240,23)
print(yase.hp) hoyi.upgrade()
\ No newline at end of file hoyi.upgrade()
print(hoyi.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