Commit e66ae482 by BellCodeEditor

save project

parent e7792809
Showing with 6 additions and 5 deletions
...@@ -4,12 +4,12 @@ class Hero: ...@@ -4,12 +4,12 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upgrade(): def upgrade(self):
yase.level=self.level+1 self.level=self.level+1
yase.hp=self.hp+1 self.hp=self.hp+1
yase.attack=self.attack+1 self.attack=self.attack+1
yase=Hero('yase',300,20) yase=Hero('yase',300,20)
houyi=Hero('houyi',250,23) houyi=Hero('houyi',250,23)
print("yase的攻击力为",yase.attack) print("yase的攻击力为",yase.attack)
upgrade() houyi.upgrade()
print("houyi的攻击力为",houyi.attack) print("houyi的攻击力为",houyi.attack)
\ 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