Commit d3bbb73c by BellCodeEditor

save project

parent 106e9a12
Showing with 18 additions and 4 deletions
...@@ -5,8 +5,23 @@ class Hero: ...@@ -5,8 +5,23 @@ class Hero:
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
yase = Hero("垭瑟",300,20) yase = Hero("垭瑟",300,20)
def upgrade():
yase.level = yase.level + 1
yase.hp = yase.hp + 50
yase.attack =yase. attack + 4
upgrade()
upgrade()
houyi = Hero("后羿",250,23) 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("垭瑟的血量值为",yase.hp)
print("后羿的血量值为",houyi.hp) print("后羿的血量值为",houyi.hp)
\ No newline at end of file print("垭瑟的攻击力值为",yase.attack)
print("后羿的攻击力值为",houyi.attack)
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