Commit 795e6f5a by BellCodeEditor

auto save

parent a1af009a
Showing with 17 additions and 3 deletions
......@@ -4,5 +4,19 @@ class Heao:
self.name=name
self.hp=hp
self.attack=attack
yase=Heao()
print(yase.hp)
\ No newline at end of file
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+100
self.attack=self.attack+10
yase=Heao("亚瑟",300,20)
houyi=Heao("后羿",250,30)
yase.upgrade()
houyi.upgrade()
print("亚瑟")
print("亚瑟等级为:",yase.level)
print("亚瑟血量为:",yase.hp)
print("亚瑟攻击为:",yase.attack)
print("后羿")
print("后羿等级为:",houyi.level)
print("后羿血量为:",houyi.hp)
print("后羿攻击为:",houyi.attack)
\ 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