Commit 32026051 by BellCodeEditor

save project

parent c5d098dd
Showing with 10 additions and 7 deletions
...@@ -4,13 +4,16 @@ class Hero: ...@@ -4,13 +4,16 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
yase=Hero('yase',300,20) yase=Hero('yase',300,20)
hy=Hero('houyi',270,23) hy=Hero('houyi',270,23)
def upgrade(): def upgrade(self):
self.level=self.level+1 self.level=self.level+1
self.hp=self.hp+50 self.hp=self.hp+50
self.attack=self.attack+4 self.attack=self.attack+4
upgrade()
yase=Hero("yase",300,20)
hpuyi=Hero("houyi",300,20)
yase.upgrade()
print(yase.attack) print(yase.attack)
print(hy.attack) print(hy.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