Commit b5ddbb9f by BellCodeEditor

save project

parent c1eb1196
Showing with 9 additions and 8 deletions
...@@ -4,12 +4,12 @@ class Hero: ...@@ -4,12 +4,12 @@ class Hero:
self.level=1 self.level=1
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upgrade(): def upgrade(self):
yase.level=yase.level+1 self.level=self.level+1
yase.hp=yase.hp+40 self.hp=self.hp+40
yase.attack=yase.attack+9000 self.attack=self.attack+9000
yase=Hero("亚瑟",120,40) yase=Hero("亚瑟",120,40)
print("亚瑟的血量是:",yase.hp) yase.upgrade()
upgrade() print("升级1次后亚瑟的等级是:",yase.level)
upgrade() print("升级1次后亚瑟的血量是:",yase.hp)
print("升级两次后亚瑟的血量是:",yase.hp) print("升级1次后亚瑟的攻击力是:",yase.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