Commit 2a624aa0 by BellCodeEditor

save project

parent f18f08ba
Showing with 14 additions and 8 deletions
......@@ -3,14 +3,19 @@ class Hero:
self.level=1
self.hp=hp
self.attack=attack
yase=Hero(200,30)
houyi=Hero(180,33)
def upgrade():
yase.level=yase.level+1
yase.hp=yase.hp+50
yase.attack=yase.attack+5
upgrade()
upgrade()
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+5
yase=Hero(300,50)
yase.upgrade()
yase.upgrade()
print(yase.level)
print(yase.hp)
print(yase.attack)
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