Commit 7f7617d4 by BellCodeEditor

save project

parent 5a68c348
Showing with 13 additions and 8 deletions
...@@ -4,14 +4,18 @@ class Hero: ...@@ -4,14 +4,18 @@ class Hero:
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
self.level=1 self.level=1
yase = Hero("亚瑟",50,10)
print(yase.hp)
def shenji(): def u(self):
yase.hp=yase.hp+20 self.hp=self.hp+20
yase.attack = yase.attack+10 self.attack = self.attack+10
yase.level=yase.level+1 self.level=self.level+1
shenji() yase = Hero("亚瑟",50,10)
shenji() yase.u()
yase.u()
print(yase.hp) print(yase.hp)
houyi = Hero("后羿",40,20)
houyi.u()
houyi.u()
print(houyi.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