Commit 7cbc4e6e by BellCodeEditor

save project

parent 5beb347e
Showing with 8 additions and 13 deletions
...@@ -3,17 +3,12 @@ class Hero: ...@@ -3,17 +3,12 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
houyi=Hero("后羿",500,50)
yase=Hero("亚瑟",400,30) def upgrade(self):
def upgrade(): self.hp=self.hp+50
yase.hp=yase.hp+50 self.attack=self.attack+4
yase.attack=yase.attack+4 houyi=Hero("后羿",500,50)
upgrade() houyi.upgrade()
upgrade()
def upgrade():
houyi.hp=houyi.hp+50
houyi.attack=houyi.attack+4
upgrade()
upgrade()
print("后羿的血量",houyi.hp) print("后羿的血量",houyi.hp)
print("亚瑟的血量",yase.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