Commit 7c8945e5 by BellCodeEditor

auto save

parent f47689a4
Showing with 16 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack,energy):
self.level= 1
self.hp= hp
self.attack= attack
self.energy= energy
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+1000
self.attack=self.attack+1000
self.energy=self.energy+1000
maku= Hero("玛酷",200,300,400)
maku.upgrade()
print("玛酷的生命值为:",maku.hp)
print("玛酷的攻击力为:",maku.attack)
print("玛酷的能量值为:",maku.energy)
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