Commit fdcd6711 by BellCodeEditor

save project

parent 9a0d2c93
Showing with 9 additions and 8 deletions
...@@ -4,11 +4,12 @@ class Hero: ...@@ -4,11 +4,12 @@ class Hero:
self.name = name self.name = name
self.hp=hp self.hp=hp
self.attack = attack self.attack = attack
def upgrade(self):
self.yase.level=self.yase.level+1
self.yase.hp=self.yase.hp+50
self.yase.attack=self.yase.attack+4
yase=Hero("亚瑟",300,20) yase=Hero("亚瑟",300,20)
print(yase.attack) print(yase.hp)
def upgrade(): yase.upgrade()
yase.level=yase.level+1 yase.upgrade()
yase.hp=yase.hp+50 print("等级为:yase.level")
yase.attack=yase.attack+4 \ No newline at end of file
upgrade()
\ 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