Commit 368f28b3 by BellCodeEditor

save project

parent 0aeeac2c
Showing with 9 additions and 8 deletions
...@@ -4,10 +4,12 @@ class Hero: ...@@ -4,10 +4,12 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upgrade(self):
yase=Hero('yase',300,20) self.level=self.level+1
hy=Hero('hy',250,23) self.hp=self.hp+50
k=Hero('K',5600,199) self.attack=self.attack+4
print(yase.attack) houyi=hero("后羿",248,23)
print(hy.attack) houyi.upgrade()
print(k.attack) print("等级为:",houyi.level)
\ No newline at end of file print("血量为:",houyi.hp)
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