Commit 5479caf3 by BellCodeEditor

save project

parent 33d28861
Showing with 12 additions and 12 deletions
...@@ -4,15 +4,15 @@ class Hero: ...@@ -4,15 +4,15 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
sb=Hero("傻逼",300,20) #sb=Hero("傻逼",300,20)
sd=Hero("沙雕",250,23) #sd=Hero("沙雕",250,23)
#print(sb.hp) #print(sb.hp)
def upgrade(): def upgade(self):
sb.level=sb.level+1 self.level=self.level+1
sb.hp=sb.hp+50 self.hp=self.hp+50
sb.attack=sb.attack+4 self.attack=self.attack+4
sb=Hero("傻逼",300,20) sd=Hero("傻逼",300,20)
print("1:",sb.hp) print("1:",sd.hp)
upgrade() sd.upgade()
upgrade() sd.upgade()
print("2:",sb.hp) print("2:",sd.hp)
\ 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