Commit 68dd0171 by BellCodeEditor

save project

parent 43752c8c
Showing with 1 additions and 2 deletions
...@@ -6,7 +6,7 @@ class Hero: ...@@ -6,7 +6,7 @@ class Hero:
self.attack=attack self.attack=attack
def upgrade(self): def upgrade(self):
self.level=self)level+1 self.level=self.level+1
self.hp=self.hp+50 self.hp=self.hp+50
self.attack=self.attack+10 self.attack=self.attack+10
...@@ -14,7 +14,6 @@ yase=Hero('亚瑟',350,20) ...@@ -14,7 +14,6 @@ yase=Hero('亚瑟',350,20)
#houyi=Hero('后羿',240,25) #houyi=Hero('后羿',240,25)
print('亚瑟的血量:',yase.hp) print('亚瑟的血量:',yase.hp)
#print('后羿的血量:',houyi.hp) #print('后羿的血量:',houyi.hp)
print('亚瑟的血量:',yase.hp)
yase.upgrade() yase.upgrade()
print('亚瑟的等级:',yase.level) print('亚瑟的等级:',yase.level)
print('亚瑟的血量:',yase.hp) print('亚瑟的血量:',yase.hp)
......
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