Commit 55fa9be2 by BellCodeEditor

save project

parent 275773df
Showing with 10 additions and 13 deletions
...@@ -3,18 +3,14 @@ class Hero: ...@@ -3,18 +3,14 @@ class Hero:
self.level = 1 self.level = 1
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
yase =Hero ("亚瑟",300,20)
houyi =Hero ("后羿",250,23)
def upgrade():
yase.level=yase.level+1
yase.hp=yase.hp+50
yase.attack=yase.attack+5
upgrade()
upgrade()
print("亚瑟的血量为",yase.hp)
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+5
houyi =Hero ("后羿",250,23)
houyi.upgrade()
houyi.upgrade()
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