Commit e8f7b598 by BellCodeEditor

save project

parent 535b816c
Showing with 9 additions and 9 deletions
...@@ -4,14 +4,14 @@ class hero: ...@@ -4,14 +4,14 @@ class hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def urgrade_yase(): def upgrade(self):
yase.level=yase.level+1 self.level=self.level+1
yase.hp=yase.hp+1 self.hp=self.hp+1
yase.attack=yase.attack+1 self.attack=self.attack+1
yase=hero("亚瑟",300,20) yase=hero("亚瑟",300,20)
houyi=hero("后羿",250,23) houyi=hero("后羿",250,23)
print("亚瑟的血量是",yase.hp) houyi.upgrade()
urgrade_yase() print("等级为",houyi.level)
urgrade_yase() print("血量为",houyi.hp)
print("升级两次后,亚瑟的血量是",yase.hp) print("攻击为",houyi.attack)
\ No newline at end of file \ 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