Commit b9151fce by BellCodeEditor

save project

parent 4cd0fc36
Showing with 19 additions and 13 deletions
class Hero:
def __init__(self,name,hp,attack):
def __init__(self):#,name,hp,attack
self.level=1
self.name=name
self.hp=hp
self.attack=attack
self.hp=300
self.attack=20
# self.name=name
# self.hp=hp
# self.attack=attack
def upgrade(self):
self.level=yase.level+1
self.hp=yase+50
self.attack=yase.attack+4
# def upgrade(self):
# self.level=yase.level+1
# self.hp=yase+50
# self.attack=yase.attack+4
houyi =Hero("后羿",240,23)
houyi.upgrade()
print("等级为:",houyi.level)
print ("血量为:",houyi.hp)
print ("攻击力为:",houyi.attack)
#houyi =Hero("后羿",240,23)
#houyi.upgrade()
#print("等级为:",houyi.level)
#print ("血量为:",houyi.hp)
#print ("攻击力为:",houyi.attack)
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