Commit 88f397a9 by BellCodeEditor

save project

parent d3bbb73c
Showing with 18 additions and 19 deletions
...@@ -4,24 +4,23 @@ class Hero: ...@@ -4,24 +4,23 @@ class Hero:
self.name = name self.name = name
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
def upgrade(self):
self.level = self.level + 1
self.hp = self.hp + 50
self.attack =self. attack + 4
yase = Hero("垭瑟",300,20) yase = Hero("垭瑟",300,20)
def upgrade(): yase.upgrade()
yase.level = yase.level + 1
yase.hp = yase.hp + 50
yase.attack =yase. attack + 4
upgrade()
upgrade()
houyi = Hero("后羿",250,23)
def upgrade():
houyi.level = houyi.level + 1
houyi.hp = houyi.hp + 50
houyi.attack = houyi.attack + 4
upgrade()
upgrade()
print("垭瑟的等级值为",yase.level)
print("后羿的等级值为",houyi.level)
print("垭瑟的血量值为",yase.hp)
print("后羿的血量值为",houyi.hp)
print("垭瑟的攻击力值为",yase.attack)
print("后羿的攻击力值为",houyi.attack)
#houyi = Hero("后羿",250,23)
#def upgrade():
#houyi.level = houyi.level + 1
#houyi.hp = houyi.hp + 50
#houyi.attack = houyi.attack + 4
print(yase.hp)
print(yase.attack)
print(yase.level)
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