Commit 5b82e7ad by BellCodeEditor

save project

parent 354335ee
Showing with 9 additions and 21 deletions
class Hero:
def __init__(self, name, hp, attack):
self.level=1
self.name = name
self.hp= hp
self.attack= attack
def unpgrade():
self.level=yase.level+1
self.hp=yase.hp+50
self.attack=yase.attack+4
houyi = Hero("后羿",240,23)
houyi.unpgrade()
print("等级:",houyi.)
print("血量:",houyi.hp)
print("攻击力:",houyi.attack)
def __init__(self):
self.level = 1
self.hp= 300
self.attack= 20
yase = Hero()
print("yase的血量值为:",yase.hp)
print("yase的攻击力为:",yase.attack)
\ No newline at end of file
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