Commit 654b5a81 by BellCodeEditor

save project

parent fbeff1b6
Showing with 5 additions and 2 deletions
...@@ -4,10 +4,13 @@ class Hero: ...@@ -4,10 +4,13 @@ class Hero:
self.name = name self.name = name
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
def upgrade(selp):
selp.level=selp.level+1
selp.hp=selp.hp+50
selp.attack=selp.attack+4
yase = Hero("亚瑟",100,20) yase = Hero("亚瑟",100,20)
dijia = Hero("迪迦",120,50) dijia = Hero("迪迦",120,50)
yase.upgrade()
print(yase.name+str(yase.hp)) print(yase.name+str(yase.hp))
print(dijia.name+str(dijia.hp)) print(dijia.name+str(dijia.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