Commit 7e5b7566 by BellCodeEditor

save project

parent 85c7a08b
Showing with 17 additions and 16 deletions
......@@ -4,19 +4,21 @@ class Hero():
self.name=name
self.hp=hp
self.attack=attack
houyi=Hero("后羿",300,40)
houyi.hp350
print(houyi.hp)
def upgrate():
houyi.level=houyi.level+1
houyi.ouyi.hp=houyi.hp+50
houyi.attack=houyi.attack+5
upgrate()
upgrate()
upgrate()
upgrate()
upgrate()
upgrate()
upgrate()
upgrate()
\ No newline at end of file
def upgrate(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+5
yase=Hero("亚瑟",300,40)
yase.upgrate()
print("*"*300)
print(yase.hp)
print(yase.name)
print(yase.attack)
print("*"*300)
houyi=Hero("后羿",200,50)
houyi.upgrate()
print(houyi.hp)
print(houyi.name)
print(houyi.attack)
print("*"*300)
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