Commit 634f71e9 by BellCodeEditor

auto save

parent bdd365ac
Showing with 13 additions and 5 deletions
...@@ -4,7 +4,15 @@ class Hero: ...@@ -4,7 +4,15 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
yase=Hero("亚瑟",300,20) #定义亚瑟升级方法
houyi=Hero("后羿",250,23) def upgade(self):
print("亚瑟的血量为:",yase.hp) self.level=self.level+1
print(houyi.hp) self.hp=self.hp+50
\ No newline at end of file self.attack=self.attack+4
#
houyi=Hero("后羿",300,20)
print("后羿的初始血量为:",houyi.hp)
houyi.upgade()
houyi.upgade()
print("后羿升两级后的血量为:",houyi.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