Commit aa51bbeb by BellCodeEditor

save project

parent 6afebd0b
Showing with 7 additions and 5 deletions
...@@ -6,11 +6,12 @@ class hero(): ...@@ -6,11 +6,12 @@ class hero():
self.attack=attack self.attack=attack
yase = hero("垭瑟",300,20) yase = hero("垭瑟",300,20)
houyi = hero("后羿",250,23) houyi = hero("后羿",250,23)
def upgrade(): def upgrade(self):
yase.level=yase.level+1 self.level=self.level+1
yase.hp=yase.hp+50 self.hp=self.hp+50
yase.attack=yase.attack+4 self.attack=self.attack+4
upgrade() upgrade(yase)
print("垭瑟的血量:",yase.hp) print("垭瑟的血量:",yase.hp)
print("后羿的血量:",houyi.hp) 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