Commit 2a624aa0 by BellCodeEditor

save project

parent f18f08ba
Showing with 15 additions and 10 deletions
...@@ -3,14 +3,19 @@ class Hero: ...@@ -3,14 +3,19 @@ class Hero:
self.level=1 self.level=1
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
yase=Hero(200,30) def upgrade(self):
houyi=Hero(180,33) self.level=self.level+1
def upgrade(): self.hp=self.hp+50
yase.level=yase.level+1 self.attack=self.attack+5
yase.hp=yase.hp+50 yase=Hero(300,50)
yase.attack=yase.attack+5 yase.upgrade()
upgrade() yase.upgrade()
upgrade()
print(yase.level) print(yase.level)
print(yase.hp) print(yase.hp)
print(yase.attack) print(yase.attack)
\ No newline at end of file houyi=Hero(250,60)
houyi.upgrade()
houyi.upgrade()
print(houyi.level)
print(houyi.hp)
print(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