Commit 09eeb95b by BellCodeEditor

save project

parent bc367a3d
Showing with 8 additions and 2 deletions
...@@ -4,5 +4,11 @@ class Hero: ...@@ -4,5 +4,11 @@ class Hero:
self.hp = 300 self.hp = 300
self.attack = attack self.attack = attack
self.name = name self.name = name
def updata(self):
self.level += 1
self.hp += 50
self.attack +=4
yase = Hero("亚瑟" , 300 , 30) yase = Hero("亚瑟" , 300 , 30)
print(yase.name + "的hp是" + str(yase.hp)) print(yase.name + "的hp是" + str(yase.hp))
\ No newline at end of file yase.updata()
print(yase.hp)
\ 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