Commit bb7426c5 by BellCodeEditor

save project

parent d2ceeb71
Showing with 11 additions and 9 deletions
...@@ -4,15 +4,17 @@ class Hero: ...@@ -4,15 +4,17 @@ class Hero:
self.name = name self.name = name
self.hp= hp self.hp= hp
self.attack= attack self.attack= attack
def upgrade(self):
self.hp+=60
self.level+=1
self.attack+=20
yase=Hero("亚瑟",300,20) yase=Hero("亚瑟",300,20)
hy=Hero("后裔",250,23) self=Hero("self",250,23)
print("亚瑟血量为:",yase.hp)
print("后裔血量为:",hy.hp)
def upgrade():
yase.hp+=60
yase.level+=1
yase.attack+=20
for i in range(14): for i in range(14):
upgrade() yase.upgrade()
self.upgrade()
print("亚瑟血量为:",yase.hp)
print("self血量为:",self.hp)
print("亚瑟攻击为:",yase.attack)
print("self攻击为:",self.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