Commit 4086965e by BellCodeEditor

save project

parent 7194ea50
Showing with 10 additions and 6 deletions
...@@ -4,15 +4,19 @@ class Hero: ...@@ -4,15 +4,19 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def updata(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+40
yase=Hero('yase',300,20) yase=Hero('yase',300,20)
yase.updata()
houyi=Hero('houyi',250,23) houyi=Hero('houyi',250,23)
houyi.updata()
def updata(): print("亚瑟的等级是",yase.level)
yase.level=yase.level+1 print("亚瑟的血量是",yase.hp)
yase.hp=yase.hp+50
yase.attack=yase.attack+40
updata()
print("亚瑟的攻击是",yase.attack) print("亚瑟的攻击是",yase.attack)
print("后羿的等级是",houyi.level)
print("后羿的血量是",houyi.hp)
print("后羿的攻击是",houyi.attack) print("后羿的攻击是",houyi.attack)
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