Commit ae62697f by BellCodeEditor

save project

parent 9aa37012
Showing with 10 additions and 12 deletions
......@@ -4,19 +4,16 @@ class hero:
self.name=name
self.hp=hp
self.attack=attack
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+5
Houyi=hero('Houyi',250,25)
Yase=hero('Yase',300,20)
def upgrade():
Yase.level=Yase.level+1
Yase.hp=Yase.hp+50
Yase.attack=Yase.attack+5
upgrade()
upgrade()
def upgrade2():
Houyi.level=Houyi.level+1
Houyi.hp=Houyi.hp+30
Houyi.attack=Houyi.attack+50
upgrade2()
upgrade2()
Yase.upgrade()
Yase.upgrade()
Houyi.upgrade()
Houyi.upgrade()
print(Houyi.attack)
print(Yase.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