Commit 8cf6cdeb by BellCodeEditor

save project

parent 42ea2805
Showing with 9 additions and 9 deletions
...@@ -5,13 +5,13 @@ class Hero: ...@@ -5,13 +5,13 @@ class Hero:
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
def upgrade(): def upgrade(self):
xiao.level=xiao.level+10 self.level=self.level+10
xiao.hp=xiao.hp+650 self.hp=self.hp+650
xiao.attack=xiao.attack+780 self.attack=self.attack+780
xiao = Hero("魈",300,20) xiao = Hero("魈",300,20)
print(xiao.hp) xiao.upgrade()
upgrade() print("等级为:",xiao.level)
upgrade() print("血量为:",xiao.hp)
print(xiao.hp) print("攻击为:",xiao.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